Computer will not return to sleep after scheduled task

cplindem

Honorable
Jan 12, 2013
31
0
10,540
Hi,
Almost every morning for the last month or so I will discover my computer is running (monitor off, but computer not in sleep mode as it should be). To figure out what was waking it, I went to cmd prompt and used the command "powercfg -waketimers":

C:\WINDOWS\system32>powercfg -waketimers
Timer set by [SERVICE] \Device\HarddiskVolume1\Windows\System32\svchost.exe (Sys
temEventsBroker) expires at 4:01:43 AM on 2/23/2014.
Reason: Windows will execute 'NT TASK\Microsoft\Windows\TaskScheduler\Regular
Maintenance' scheduled task that requested waking the computer.

I also tried "powercfg -lastwake":

C:\WINDOWS\system32>powercfg -lastwake
Wake History Count - 1
Wake History [0]
Wake Source Count - 1
Wake Source [0]
Type: Wake Timer
Owner: [SERVICE] \Device\HarddiskVolume1\Windows\System32\svchost.exe (Syste
mEventsBroker)
Owner Supplied Reason: Windows will execute 'NT TASK\Microsoft\Windows\TaskS
cheduler\Regular Maintenance' scheduled task that requested waking the computer.


So it appears that "Regular Maintenance" is waking my computer. But why isn't it returning to sleep? It used to.

I then went to Power Options > Edit Plan Settings. These settings are still correct (Put the computer to sleep: 30 minutes).

Next I checked the Task Scheduler. Under "Active Tasks" I found "Regular Maintenance".

Next run time: 3:53 AM tomorrow. That very closely matches the 4:01 AM listed in "powercfg -waketimers", but I find it odd that it is after the scheduled time.
Triggers: At 3:00 AM every day

Doubling clicking on Regular Maintenance provides more detail.

Last Run Time: 5:46 AM
Last Run Result: operation completed successfully

However, another item in here is "Idle Maintenance".

Triggers: when computer is idle
Last Run Time: 5:46 AM
Last Run Result: The process terminated unexpectedly. (0x8007042B)

Could this be the problem?


Any help is greatly appreciated.
 
Solution
Yeah, I guess I could do that. Anyway, I let it go overnight and it was awake again this morning.

But Task Scheduler has slightly different results this time.

Regular Maintenance:
Last Run Time: This morning at 3:40 AM
Last Run Result: The operator or administrator has refused the request. (0x800710E0)

Under Idle Maintenance:
Last Run Time: This morning at 7:17 AM
Last Run Result: The process terminated unexpectedly. (0x8007042B)
start control panel, find administrative tools, defragment and optimize your drives
find your system reserved partition and disable and turn off the scheduled optimization.

At least on my system windows does not try to run the optimization on the other Solid state drives partitions during maintenance. I think it is a bug to to that, it returns a error (87 invalid parameter) anyway and I think it blocked the system from sleeping.

There are other things that can cause the same problem. print spooler with a document waiting to be printed,
various homegroup issues. but you mentioned the scheduled maintenance and if it does not finish, I think it would keep the system awake.

change it and see if you still get the same issue



 
All of my drive partitions are scheduled to optimize weekly rather than daily. My computer is waking up daily, so it doesn't seem like that is the issue.

No documents in the print spooler either.
 
On my system it just ran it each time because it failed the last time it ran. You might have a different issue, it was just a heads up on what fixed my systems failure to sleep after the system maintenance task ran.
maybe event viewer will tell you what actual process aborted with the error code 0x8007042b
0x8007042B = ERROR_PROCESS_ABORTED
 
Last night I turned all scheduled optimization off. This morning my computer was again woken from it sleep.

The cmd prompt gives me the same reason for the wake (Regular Maintenance).

Task Scheduler shows Regular Maintenance as:
Last Run Time: This morning at 4:36 AM
Last Run Result: The last run of the task was terminated by the user. (0x41306)

Under Idle Maintenance it shows nothing for this morning.


What does this mean? Optimization ran despite me turning it off?
 
the maintenance script will still run until you disable it. You might want to go into task scheduler and look at the running tasks to see if one is getting a error. (something like tasked failed to complete and a error code indicating incorrect privileges to run. The last time got this error all I had to do was right mouse click to bring up the properties
and select the "run with highest privileges" checkbox after i did that the system would sleep correctly after I ran the maintenance task. Only other thing I might of done was to terminate all of the running tasks and rebooted around the same time I made the change. (so I am not exactly sure which change actually prevented the problem the next day)

there can be other errors: for example some task might not run unless a user is logged on at the time. or have some setting that keeps it running for days.





 
Yeah, I guess I could do that. Anyway, I let it go overnight and it was awake again this morning.

But Task Scheduler has slightly different results this time.

Regular Maintenance:
Last Run Time: This morning at 3:40 AM
Last Run Result: The operator or administrator has refused the request. (0x800710E0)

Under Idle Maintenance:
Last Run Time: This morning at 7:17 AM
Last Run Result: The process terminated unexpectedly. (0x8007042B)
 
Solution
Maybe select "run at the highest privilege level" in the task scheduler



 
That's what I did. Did you mean I could try it somewhere else?

There is another option for "wake the computer to run this task", but I assume it simply would not run at all if I unchecked that box.