Friday, October 9, 2015

Why does my PC refuse to fall asleep?

I have a Windows 8.1 machine, and it would not sleep no matter what.

The display would turn off, but it just never wanted to go into the Standby mode.

Long investigation revealed two issues:

  1. The common one - media streaming + the homegroup issue (this one is easy to google).
  2. My soundcard driver was keeping the PC awake using SetThreadExecutionState API.
If you are only looking for the first one, you can use powercfg.exe /requests, and look for any requests on the SYSTEM level. You can actually override such requests and if it is the only problem, then it will go away.

The other one can only be detected by running the powercfg.exe /energy command. It generates a report which includes information about everything that Windows knows about Just run that, read the report, read through everything in the Error section. Any problem related to preventing windows from sleeping has to be addressed. In my case I had to install a proper driver instead of a default one.

Btw, a side note on the first issue. In my cases tweaking media sharing settings or the homegroup settings did not actually help. The following this was still showing up in the report from powercfg /requests: "\FileSystem\srvnet"

At the end the solution was quite simple: stop and disable Homegroup Listener and Homegroup Provider services (I do not us the homegroup) and a service called "Windows Media Player Network Sharing Service". That was it, the request for staying awake was gone.

UPDATE: It has turned out that after the restart the sound card driver is still preventing my PC from sleeping. There are two applications that can be blamed for that: Steam and UPlay. Both have some well-known bugs that do not release the sound card resources, and that prevents the PC from entering the Sleep mode. So either have to close the apps, or press the sleep button manually. Eventually I will look into some brute force way of overriding this behavior - I would rather have my PC go to sleep when unattended than not go to sleep unless I remember to press the button...

No comments: