Monday, October 01, 2012 11:20 AM
I run a backup program in the night. After starting the program, I manually changed the power saving option to "never sleep".
After the backup program runs, a script executes which sets the powersaving option back to my normal 30 minutes; and then calls the shutdown command:
powercfg -x -standby-timeout-ac 30
shutdown /s /t 300 /c "Type 'shutdown /a' on command line to abort the shutdown"
However, last night the computer did not shutdown; rather it went to sleep about two minutes after the shutdown command was executed. When I woke up the computer about an hour or so after it should have shut down, there was a message that it would be shutting down at a time which was in about two-three minutes from now.
This is a newly built computer; I am fine-tuning things; and the precise circumstances of this event have not occurred previously.
I considered that maybe I didn't really set the sleep timer to "never", but think it unlikely because the backup task (Acronis True Image Home 2010) does not usually keep the computer awake when it executes from the Acronis scheduler. But this time it was being executed manually. I don't know if that could make a difference.
From the Event Viewer log, one can see that the shutdown command was issued at 2:59:42; and the computer entered sleep at 3:01:53.
Any suggestions on further trouble shooting would be much appreciated.
Tuesday, October 02, 2012 4:02 AMModerator
I have run these two commands successfully. The computer shut down properly. How about not running the backup program for a test?
Please ensure the script has been run with administrator privileges. Meanwhile, you can test the script in clean boot.
TechNet Community Support
Tuesday, October 02, 2012 11:53 AM
Thank you for those suggestions. I, too, have run those commands successfully when the computer is awake. However, I set up a series of tasks in the Task Scheduler to see what would happen running those commands with the computer asleep.
- I set the "sleep time" to 1 minute
- Tasks to be run at one minute intervals starting a few minutes after going to sleep:
Set sleep time to never
Show a message
Run the script above (set sleep time back to 30 minutes; then do the shutdown)
The results were similar to when I had the backup program running, in that the computer went to sleep after the shutdown command was issued, but never actually shut down. That command resumed when I woke the computer from sleep with my mouse.
HOWEVER, I believe I have found the problem, and it is likely by design. I had suspected this initially because of the 2 minute interval between the completion of my taks, and the computer going back to sleep. There apparently is a parameter called "System Unattended Sleep Timeout" which is not normally accessible in the Power Options dialog boxes. As per its name, this is different from the usual Sleep parameters. It's default value is two minutes. It can be changed either directly in the registry; or by modifying the registry so that the option appears in the advanced Power Options dialog boxes. I chose to do the latter and have altered it from the default two minutes to ten minutes. I suspect that any time longer than the delay in my "shutdown" command would work.
- Marked As Answer by Ron Rosenfeld Tuesday, October 02, 2012 12:35 PM