Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Sleep Return Timeout for Unattended Wake Up

22 Jul 2015   #50

Windows 7

Another question for you, Brink:

I can't figure out a way for my computer to force back to sleep, is there a way to make my computer wake-up (from a shut down state) at a specific time?? If you have a tutorial regarding this, let me know but I don't think I saw one.

The reason I ask is that if I can wake-up my computer from a shut down state and clearly have way to force it shut down, this may be a work around. However, this somewhat works against the whole point of putting the computer in a sleep state.


My System SpecsSystem Spec
23 Jul 2015   #51

Windows 7 Home Premium 64 bit


You mentioned that the rundll32.exe powrprof.dll,SetSuspendState command shuts down your PC. Are you referring to a complete PC shutdown where you need to push your PC's power button in order to power up your PC after using rundll32.exe powrprof.dll,SetSuspendState ?

I'm wondering if your PC is actually getting put into 'hibernate' mode. I have both of my Win 7x64 PC's 'hibernate' option disabled and have been using a "forced Sleep" action without problems for about 3 years.

You might try disabling 'hibernate' in a CMD window. That usually needs to be disabled in order for the rundll32.exe powrprof.dll,SetSuspendState command to put the PC to Sleep mode (instead of 'hibernate' mode) if run from within a batch job or possibly the Task Manager.

To disable 'hibernate', open an elevated CMD window.

At the CMD prompt, enter this to check your current Sleep/Hibernate PC states:

powercfg -a

You should see something like this returned in system information. Here's my Desktop PC's current info when I use the "powefcfg -a" query:

The following sleep states are available on this system: Standby ( S1 S3 )
The following sleep states are not available on this system:
Standby (S2)
The system firmware does not support this standby state.
Hibernation has not been enabled.
Hybrid Sleep

if your 'hibernate' option is enabled, you can disable it with this command:

powercfg -h off

If my memory's working right, the rundll32.exe powrprof.dll,SetSuspendState requires the 'hibernate off' command to be included in a batch file in order for the command to put the PC into Sleep mode and not 'Hibernate' mode. That also requires the batch file to be run in "Admin" (elevated" mode.

Another option for you to use with Task Scheduler to force the PC to Sleep mode, is to use a free utility from one of the "Sysinternals" tools called "psshutdown".

Here's the link to the "psshutdown" download site that can be used to do what you're wanting to do with your PC.

psshutdown v2.52

It's a standalone .exe file that can use used to put the PC to Sleep mode with a batch file or a Task in Task Manager.

The "-d" parameter is the one that puts the PC to Sleep mode.

For example, included is a screencap from a "Sleep Test" task that I created and tested on my PC.

I have my "psshutdown" exe file in my top C: directory so I entered that in the "program/script" field.

Then you add the "-d" parameter in the "add arguments" field.

The "-t 30" parameter is a time-delay (30 seconds in this example) that you can use to delay the psshutdown exe file from putting the PC to sleep. I think the default time delay value is 20 seconds.

I ran this Task in my Win Task Scheduler a couple of times and it worked ok.

I've been running my "Sleep" task another way using a freeware hotkey/script program called "AutoHotKey". Within AutoHotkey, there's a command that will put the PC to sleep:

DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)

I'm using it in a way that's similar to what may be what you're wanting to do with your PC.

For example,

I have a daily specific-item backup job that runs unattended at 12:00pm on my PC. The job takes about 1-2 minutes to complete.

At 12:05pm, my "Sleep" task runs which puts the PC back to sleep. I've been running this for about 3 years without issue.

Attached Images
Sleep Return Timeout for Unattended Wake Up-task-actions.png 
My System SpecsSystem Spec
23 Jul 2015   #52

Windows 7

Hi Scoop,

Thanks for your reply.

In answer to your first question, as far as I can tell, it appears to be a complete shut down of my PC when rundll32.exe powrprof.dll,SetSuspendState "task" runs via my Windows Task Scheduler -- I do need to push the power button to get the PC going again.

Should I still try and disable the hibernation option and see what happens?

If that fails, should I then consider your "psshutdown" and "autohotkey" options??

Let me know and thanks for your advice once again.

My System SpecsSystem Spec
23 Jul 2015   #53

Windows 7 Home Premium 64 bit


That's strange, the PC shutting down using rundll32.exe powrprof.dll,SetSuspendState .

I've never seen that occur with my Desktop PC. My Laptop PC is a backup PC so I'm not using it much to test things like this but I got curious about it and tried it on my Laptop PC. The results are interesting.

Is your PC a Desktop or Laptop? If it's a Laptop, then the 'hibernate' mode being enabled may be what you're seeing as I just ran a test on my Laptop PC (Toshiba Laptop) with 'hibernate' disabled and enabled using the rundll32.exe powrprof.dll,SetSuspendState command. Here are the results:

I opened a CMD window and disabled 'hibernate' mode in CMD.

I then entered the rundll32.exe powrprof.dll,SetSuspendState command in the CMD window.

The PC went into normal Sleep mode, requiring any key pressed, etc, to awaken the PC. (PC power button not required to awaken the PC).

After awakening the PC, I enabled 'hibernate' on my Laptop PC and repeated the rundll32.exe powrprof.dll,SetSuspendState test in CMD .

The PC went into 'hibernate' mode which required the power button on the Laptop to be pressed to wake the PC (take it out of 'hibernate' state) since 'hibernate' is sort of like a partial restart, as the PC's environment is saved to the HDD when invoking the 'hibernate' mode so any workspace/windows, etc, that were open and in use at the time the PC went into 'hibernate' state, will be resumed once the PC is awakened.

This is why I like using my AutoHotKey script since the rundll... command is dependent on the 'hibernate' state and the Sleep script command is not dependent on whether 'hibernate' is enabled or disabled.

If the CMD (rundll...) test still shuts down the PC instead of going into Sleep mode, you might want to verify that the manual interactive "sleep" function is working ok on your PC (see next).

Does your PC go into Sleep mode and not shut down when you click on the Sleep option from your Start menu power button?

You can also verify the Sleep mode from the Windows Shutdown Menu like this:

- Put your PC in Desktop/active mode (close all other apps, windows).

- Hold down the <alt> key while pressing the F4 key. You should see the Windows Shutdown Menu appear (see included screencap).

- Select the Sleep Mode and verify that your PC goes into Sleep and not a complete shutdown state.

If that works ok, you might try the "psshutdown" download exe file.

Once you have extracted the zip folder download, you'll see several files in the folder. Move just the "psshutdown" exe file into your C: directory.

To test the Sleep mode using psshutdown,

- Open an elevated CMD window.

- Disable "hibernate" mode if it's not already disabled:

hibernate -h off

Enter this at the CMD prompt:

cd \ (this changes your default directory location in CMD to your C: directory where your psshutdown file is located).

Then, enter this:

psshutdown -d -t 30

Your PC should go into Sleep mode in 30 seconds.

If that works, that should verify that the basic "sleep" command and your power configurations are working ok.

it should also then work from within the Task Manager as a Task.

Attached Images
Sleep Return Timeout for Unattended Wake Up-shutdown-menu.png 
My System SpecsSystem Spec

23 Jul 2015   #54

Windows 7

Hi Scoop,

Actually you were right -- my computer was going into "hibernate" mode with the rundll32.exe powrprof.dll,SetSuspendState command. I really have never used hibernate for much of anything since this is all being done on my Desktop.

Hibernation appears very similar to shutdown to the untrained eye (like me!)

Anyway, I disabled the hibernation mode in the elevated CMD and now things seem to be working as they should be with my computer going into sleep mode.

Another question for you -- will there be any issue or problem with keeping the hibernation mode disabled on my Desktop PC?? As I said, I seen the benefit of the mode on a laptop but not much so on a Desktop.


My System SpecsSystem Spec
24 Jul 2015   #55

Windows 7 Home Premium 64 bit


Glad it's working ok now.

Here's a link to one of Shawn's ("Brink") tutorials at this site that explains the differences with the "Sleep" states and "Hibernate".

Sleep States - See Available Sleep States

As for "Hibernate", I don't use it myself because I'm always at "Desktop/idle" mode when I invoke Sleep interactively or unattended with a Task or script.

Since all of my apps/windows, etc, are closed when Sleep is launched, the Hibernate option isn't needed for my PC habits since I don't require my PC's environment to be saved to the HDD in the event of a power interruption occurring with my PC.

if you routinely close your apps/files, etc, before you leave your PC (before you use the Sleep mode), then Hibernate isn't required from my POV.

I've had my Hibernate disabled on my Desktop since 2010 without issues.

I left it enabled on my Laptop but I don't use it as I also close any activities before invoking Sleep mode.

"Untrained eye".... don't be concerned about that . My "eye" is about as trained as a gnat compared to many contributors at this forum
My System SpecsSystem Spec
07 Aug 2015   #56

Windows 7

Hi Scoop (or Brink if your still reading):

I have another question for you:

Since the rundll32.exe powrprof.dll,SetSuspendState command has been working as it should via my Windows Task Scheduler, I have noted something a little odd -- after the command has run, and later on, I "wake" my computer up (hit the keyboard or click on the mouse) and then leave it idle, it FAILS TO GO BACK TO SLEEP. My power plan is balanced and is set to go back to sleep after 15 minutes; however, it seems that IT IS NOT GOING BACK TO SLEEP after the 15 minutes elasped time.

My understanding of what should happen is what Brink said at that the beginning of this original tutorial:

"If the computer wakes up from sleep mode and is used by you (no longer idle) during this default timeout period, then Windows will not go back to sleep mode automatically after this timeout period. Instead it will use the time period you set in your Power Plan Settings for Sleep or Hibernation"

Do you actually have to "work" on the computer (ie log in and then email, internet surf...etc) AND THEN LEAVE IT IDLE for the computer to fall back asleep or is there something else I am missing.

As always, thanks for your help.

My System SpecsSystem Spec
07 Aug 2015   #57

64-bit Windows 10 Pro

Hey Tim,

Used basically means any activity caused by the user. This could be as simple as the mouse moved. Say by a cat playing with it.
My System SpecsSystem Spec

 Sleep Return Timeout for Unattended Wake Up

Tutorial Tools Search this Tutorial
Search this Tutorial:

Advanced Search

Similar help and support threads
Windows 7 Tutorial Category
Power Options - Add "System unattended sleep timeout"
How to Add or Remove "System unattended sleep timeout" in Power Options "System unattended sleep timeout" is how many minutes the system will wait idle after waking up in an unattended state before automatically going back to sleep or hibernation. This tutorial will show you how to add or...
Laptop extremely slow to wake up from sleep mode, 5+ minutes to wake
Hi, I am new here. Hoping someone can help me out with this issue. I work in IT so am not a complete computer bonehead and am at my wits end with this. My laptop is about 4 years old, it's a toshiba. For whatever reason, it started taking 5+ minutes to wake up from sleeping. If it sleeps...
Performance & Maintenance
Wake events: how to discriminate between "unattended" and manual
I recently set up an HTPC for my mother to replace her rented DVR (Cable company charges $13/mo for the DVR but a CableCARD is just $2/mo). I have everything pretty much like she wants it, but there is one remaining issue. She has an LG TV and wants everything to come on with the MC remote so she...
Media Center
BSOD upon return from Sleep on new Rig
New rig, put it together a week ago. Getting a BSOD after waking the computer; has happened twice so far. Running windows 7 professional x64. I manually installed it onto a vertex agility 3 SSD (120gb). I've ensure that all my drivers are up to date, to include the SSD's firmware. I've...
BSOD Help and Support
Auto Return to Sleep after wake up
Can't say I really dislike much about Win 7 - EXCEPT: It will not honor the "Return to Sleep" timeout value that is in the registry - when the Power Plan is set to High Performance. If this plan is in play - and I need the machine to wake for - say - a backup at 2:00am...the machine will wake...
General Discussion
How to get 'away' mode unattended wake-up for tv record
If I schedule a tv recording and put my HTPC to sleep, it fully wakes up to do the unattended recording at the right time but with the display on and everything running rather than in 'Away' mode as I have set up on the same machine under Vista. I used a great little program called MCE Standby to...
Media Center

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 22:12.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App