Wow! I've got the solution! It turned out that making Windows not to prompt
for password during certain period is quite possible! I haven't found any
registry settings for power options, but great thanks to Ulrik Jensen, who
posted about powercfg, a cool tool from Windows command prompt, allowing an
administrator to control the power settings on a system. Powercfg allows to
change the setting enabling or disabling the requirement that the user supply
a password when the system resumes from standby or hibernate. More detailed
info on using
powercfg you can get by typing "powercfg /?" in Command Prompt.
My goal was to make Windows automatically switch the "Prompt for password
when computer resumes from standby" setting (Control Panel ->Power
Options->Advanced tab) off and on at specific time.
So, I created two batch files.
The first one contains:
POWERCFG /GLOBALPOWERFLAG off /OPTION RESUMEPASSWORD
start /dC:\Progra~1\Smarts~1 /b Smarts~1.exe hibernate
The first powercfg command disables the requirement that the user supply a
password when the system resumes from standby or hibernate.
The second command make Windows hibernate using third-party Smart Shutdown
utility (
http://www.slawdog.com/downloads/index.htm#Smart Shutdown) that
supports hibernation from command prompt (the other way to hibernate from
command prompt is using
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState
command. It makes Windows hibernate as well as Smart Shutdown but for some
reason it doesn't allow the computer to wake to run the scheduled task (see
below)).
So, each time I want Windows not to ask me the password after resuming from
standby/hibernation, I simply run this batch file (using shortcut key for
convenience). The setting "Prompt for password when computer resumes from
standby" is being switched off and the computer hibernates.
The second batch file contains:
POWERCFG /GLOBALPOWERFLAG on /OPTION RESUMEPASSWORD
start MyApp
The first command enables the requirement that the user supply a password
when the system resumes from standby or hibernate.
start MyApp command executes the MyApp program I need to run automatically
when I'm not at home.
So, I have a scheduled task that makes the computer wake to run it. The task
launches the second batch file. The setting "Prompt for password when
computer resumes from standby" is being switched on and the required program
runs. That's exactly what I wanted.
Thanks to all for helping me and paying attention to my problem. And sorry
for multiposting