Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, January 23, 2016 9:27 PM | 2 votes
When I put the system to sleep using the following: c:\windows\system32\rundll32.exe powrprof.dll SetSuspendState 0,1,0
The system will not wake up to run any scheduled tasks. But if I click on the start button/power/sleep. This puts the PC to sleep and it will wake up to run scheduled tasks.
What did Microsoft change or break?
RAC
All replies (13)
Monday, January 25, 2016 10:01 PM
Ever since upgrading to windows 10. My PC won't wake up when a scheduled task request a wake up. If I use the setsuspendstate 0,1,0 or psshutdown -d -t 0 neither will allow the system to wake up for a scheduled task. But if I
Click start/power/sleep. Then it wakes up. Am I the only one that has this problem? I've spent hours googleing this problem with no fix.
Any help would be appreciated.
RAC
Tuesday, January 26, 2016 12:01 AM
I shall suggest you to update your graphic card driver either via the support site of the graphic card manufacturer or windows update and recheck the issue.
S.Sengupta, Windows Experience MVP
Tuesday, January 26, 2016 12:19 AM
I've checked the graphic cards driver. It is up to date. Are you saying that if the driver is not the latest that the system will not wake up? If that is the case why does it wake up if I put the system to sleep using the start/power/sleep method. But fails to wake up when the system is put to sleep programmatically?
RAC
Tuesday, January 26, 2016 7:29 AM | 1 vote
Hi RAC,
The description makes me think that the normal wake up of Windows 10 is not from the sleep mode.
Please verify the power options and make sure we configured the idle time before going into sleep of the system, not the other options.
I didn't find any power management updates articles about Windows 10, if found, I will update here.
Regards
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].
Tuesday, January 26, 2016 12:35 PM | 2 votes
What is the difference between clicking on start/power/sleep and psshutdown -d -t 0 or c:\windows\system32\rundll32.exe powrprof.dll SetSuspendState 0,1,0 If I click on the sleep icon every thing works. But the other two methods fails.
RAC
Tuesday, January 26, 2016 9:55 PM
I've kludged around the problem. I have a powershell script that moves the mouse to do a start/power/sleep.
Using this script the system now wakes up when it is supposed to wake up.
RAC
Wednesday, January 27, 2016 7:36 AM
Hi rac8006,
Currently there is no documentation on this part.
So if we would like to know how it happens, we might need to take an investigating with some tools like process monitor, or process explorer:
https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255&MSPPError=-2147217396
https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx
Regards
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].
Wednesday, January 27, 2016 2:38 PM | 1 vote
Explain how I would gather information using these tools. When I issue the psshutdown -d -t 0 or c:\windows\system32\rundll32.exe powrprof.dll SetSuspendState 0,1,0 command the system goes to sleep. It would be nice it I could trace what is going on when these commands are issued. It would also be nice to know what happens when you click start/power/sleep? I was trying to find where the information for what happens when sleep is clicked. But I can't find anything in the registry or any where else.
To me it looks like the setsuspendstate disables the wake alarms. I tried 0,1,0 and 0,1,1 they both worked the same.Don't know what psshutdown uses to shut down the system.
For the first time since July both system woke up and ran the house keeping tasks.
RAC
Monday, July 25, 2016 3:08 PM
I can wake with: sleep button, PsShutdown
I can NOT wake from: setsuspendstate
Monday, July 25, 2016 3:10 PM
Working Solution!
I had to use the PsShutdown utility to allow proper sleeping (primary issue is SetSuspendState does not allow wake timers to wake up the machine). My batch file to sleep is 1 simple line: PsShutdown -d -t 2
My whole setup is: scheduled task runs a VBS to monitor backup before going to sleep; when ready to sleep the VBS runs the bat file w/ psshutdown -d
Running the vbs from task scheduler w/ highest privileges prevents UAC prompts when using PsShutdown.
Monday, July 25, 2016 3:13 PM
Another note - other forums have made it clear that the Booleans after setsuspendstate are not read by the system; it will always run setsuspendstate as 1,1,1 not matter what you command. The third boolean is "disable wake timers"; therefore using setsuspendstate won't allow wake timers.
I think i used setsuspendstate just fine on my old machine with both win7 and win10, but my new win10 desktop would not wake, so I used the PsShutdown as in my other reply above.
Monday, July 25, 2016 3:57 PM
This is my current code to suspend. I call Do_Suspend and it puts the system to sleep. My scheduled task work fine now.
RAC
Function Do_Suspend {
Start-Sleep -Seconds 15
# $msg = "Entering Standby at: " + (Get-date)
# Write-EventLog -LogName system -Source EventLog -EventID 1 -message $msg
Write-Host "Entering Standby at: $(Get-date)"
WriteLog 9999 "Entering Suspend"
[System.Windows.Forms.Application]::SetSuspendState('Suspend', $false, $false)
# c:\windows\system32\rundll32.exe powrprof.dll SetSuspendState 0,1,0
WriteLog 9998 "Wakeing up from suspend"
Start-Sleep -Seconds 5
# $msg = "Waking up from standby at: " + (Get-date)
# Write-EventLog -LogName system -Source EventLog -EventID 1 -message $msg
Start-Sleep -Seconds 15
Write-Host "Waking up from standby at: $(Get-date)"
}
Tuesday, July 26, 2016 1:30 AM | 1 vote
rundll32 should not be used for calling SetSuspendState because its signature doesn't match the one expected by rundll32.
See: https://support.microsoft.com/en-us/kb/164787 and https://msdn.microsoft.com/en-us/library/windows/desktop/aa373201(v=vs.85).aspx
The first parameter gets garbage instead of FALSE value, so it always hibernates instead of going to sleep.
But I have also noticed that the third parameter of SetSuspendState affects the wake timers: after calling it with TRUE scheduled tasks stop waking the system, and after calling with FALSE they work again.
The settings in the Control Panel for awake timers are not respected. (that's weird)
I have tested it on Windows 7 and on Windows 10 with the same results.