Preventing computer from going into sleep mode

To prevent Windows from going into standby / sleep after certain period of inactivity you can use free utility developed by David Anson called Insomnia. You can download from here or from author's MSDN blog.

insomnia by David Anson

There is no need to install anything, simply unzip the file and run either 32 or 64 bit version depending on your Operating System. While utility is running computer will not go into sleep mode because of inactivity.

This, however, doesn't prevent computer from going to sleep if user presses sleep button in the start menu or on the keyboard.

To disable sleep mode completely you can use Local Group Policy:

  • Launch Local Group Policy Editor (gpedit.msc)
  • Navigate to Computer Configuration > Administrative Templates > System > Power Management > Sleep Settings
  • Open Policy called Allow Standby States (S1-S3) When Sleeping (Plugged In) and set value do Disabled
  • If necessary also do the same for Allow Standby States (S1-S3) When Sleeping (On Battery)

Allow Standby States (S1-S3) When Sleeping

Since I needed to enable / disable sleep mode via Group Policy quite often, I created quick and dirty AutoIt script that opens Local Group Policy Editor and navigates to the correct GP:

 
#RequireAdmin
ShellExecute("gpedit.msc")
WinWaitActive("Local Group Policy Editor")
Send("ad")
Send("{RIGHT}")
Send("sy")
Send("{RIGHT}")
Send("po")
Send("{RIGHT}")
Send("sl")
Sleep(1000)
Send("{TAB}")
Send("allow")
 

This policy will disable all sleep modes completely.

Sleep in Start Menu disabled


To also disable Hibernate mode (standby state S4) run powercfg.exe /hibernate off in an elevated command prompt:

  • Start > type Command Prompt > right click on Command Prompt and click Run as Administrator
  • Type powercfg.exe /hibernate off and press Enter

Both Hibernate and Sleep disabled

 

Windows 7 Pro 
Windows 8 Pro

Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait