Helping to put your Windows 10 machine to sleep!

Helping to put your windows 10 machine to sleep!

So over the last month or so, something has been bothering me about my main work station. It wouldn’t go to sleep. I don’t know exactly when it first started happening, but it was definitely after a windows update. It was irritating me. I would set it to sleep only to have it come back on almost immediately within a few seconds. Sometimes a minute or so. In the end,  I would just power it off. I mean with people running windows on NVME drives, it’s hardly a hassle waiting for a few seconds for it to boot up, but that being said, during the day when I wasn’t at my machine it would bother me having it sitting there alive and whirring away. I started to do some investigations and found a few tips and tricks for diagnosing what could be the issue. I will detail my journey below with potential solutions that could help you get your machine to sleep. I made sure that all drivers were updated in my system and that for every terminal command or powershell command I am using below, I am running as admin.

First thing, we need to know what’s stopping the pc from going to sleep….

in the command prompt type: powercfg -requests

 

command prompowercfg -requests
command prompowercfg -requests

Ideally, there should be None under each of the various articles. In my case you can see that svchost.exe (Universal Orchestrator) is causing the request. A quick search online showed this had something to do with Windows Update. The next step was to try and prevent this process from interrupting the sleep command. Next I typed the following: powercfg -requestsoverride SERVICE UsoSvc EXECUTION

powercfg -requestsoverride SERVICE UsoSvc EXECUTION
powercfg -requestsoverride SERVICE UsoSvc EXECUTION

That should of been that. I set the machine to sleep, but after literally 5 seconds it came roaring back to life. Ok, next step, what can we look at next?

I wanted to make sure that there was nothing switched on within Windows that was making requests to come out of sleep. Next I headed over to the control panel.

Control Panel\System and Security\Security and Maintenance

I then looked under the automatic maintenane settings. I decided to leave this box checked (for now) as I was happy for Windows to do things to the machine at 2am. In any event I doubted that this function was what was stopping the machine going to sleep at 11pm!

automatic maintenance
automatic maintenance

Next I wanted to check for WOL (wake-on-lan) options to make sure it was something on my network that was causing the machine to keep waking up.

I went to the device manager from the start menu (just type DEVMGR) and expand the tree until you get to the network adaptors.

network adaptors
network adaptors

 

Then for each network adaptor that you use right mouse click and bring up the properties window. Once on the properties window switch to the Power Management tab. Here I made sure to uncheck the ‘allow this device to wake the computer‘ although I did check the first option. Then rinse and repeat for each network adaptor that you think could possible be causing this. For me it was just wifi and my ethernet port.

allow wol
allow wol

Next, I tested sleep again. After about 5 seconds the machine came roaring back to life. Next point of attack. Let’s consider what is able to wake the pc. I went back into the command line (as admin) and ran the following command: powercfg /energy

powercfg /energy
powercfg /energy

After a few moments, a system generated report was created. I opened this file using google chrome (located C:\Windows\System32\). I wont paste the output of that file here, but suffice to say there is a shed load of detail about what’s going on with your system. One of the main things I was noticing was that I was seeing a lot of red blocks surrounding the text “USB Suspend:USB Device not Entering Selective Suspend

I then thought about all the USB devices that could be causing the machine to stay awake. Aside from the obvious ones like keyboard and mouse, I also have things like an Elgato Streamdeck, Webcam, blue yeti mic, and a cheap USB powered ring light to help my webcam perform better. I concluded that the first thing I should be targetting was the mouse. I’m rocking a gaming mouse which is sensitive for gaming. I presumed that even if i release the mouse after clicking the sleep button in the start menu, I could somehow be causing a slight movement after the event. I’m not interfering with any of the other USB devices, so figured this would be a good place to start. Back into device manager (start menu + DEVMGR). I expanded the mice and other pointing devices category and began to go through each item.

input devices
input devices

I went through each mouse and pointing device option (right click + properties). On only two did I have the power management tab available. Once there I switched off the ‘allow wake’ option.

input devices
input devices
allow this device to wake
allow this device to wake

What was strange was that my mouse is a logitech 502, yet my keyboard is a Razer BlackWidow. It’s odd that my keyboard is showing a mouse driver? None the less I switched it off and also switched off this option on the only other HID-compatible mouse to have the Power Management tab on its properties. I left this selected on in the keyboard device category, as I wanted the ability to wake from that.

With bated breath I tried the sleep function. Bingo! After 10 minutes the machine still sat there peacefully. Nothing whirring, nothing making a sound. I decided to leave it for the evening and come back the next morning. The machine was still asleep (despite the 2am maintenance call which I chose to leave on earlier). Pressing any button on my keyboard wakes the machine as normal. The mouse, however, will not wake the machine unless I actually click it. Again, I am still not completely sure how the drivers are set up to allow this, but moving the mouse from side to side like waving goodbye to a grandparent does nothing. If I click the mouse button it kicks into action. This is perfect. I’m now on day 4 of having my sleep function back. I can’t be sure exactly what was the specific factor preventing the sleep function, but for now the steps above seem to have cured me. There are definitely some peculiarities which it comes to the drivers surrounding the mouse and keyboard, but quite frankly, that’s Microsoft for you!

Over the coming weeks I might go back to switching on WOL on the network interfaces as I liked the idea of home-assistant/node-red being able to wake on the PC as part of my “gametime” routine, or having everything put to sleep automatically as part of my night time routine. For now though, am happy to enjoy a lower power bill!

Cheers

 

** Edit: Another windows update appears to have caused issues with my system for sleeping again. Here’s a further process to correct it!

  1. Win+R – enter Services.msc
  2. Click on Windows Update Service (right mouse button).
  3. ‘Stop’ the service if it’s running. Then ‘Start’ and ‘Restart’
  4. Run Windows Update again, let it install what it needs. Reboot your machine.

That’s it, you should be up and running again with fully functioning sleep. Not sure what Microsoft is playing at, but this worked for me. I’m currently on the following build:

Windows 10 Pro (2004) / OS Build 19041.508. (you can find this out by hitting Win+i => System => About **

 

Leave a Reply