First the question; How do I figure out what is preventing my Windows 7 computer from going into sleep mode?
Second; some background…
I've been struggling with this for a few days and am utterly perplexed. I setup sleep mode on my Windows 7 PC a few weeks ago, and all was well. The PC would sleep as expected and I was snuggly in knowing that my computer was saving power and some wear and tear on the components (we'll leave the 'is it better to sleep' debate for another thread/day, please don't start it).
Well, I noticed the other night that my system stopped ever going to sleep. I set the sleep time down to 1 minute and wandered fully away from the PC (ensuring that no errant mouse or keyboard movements would occur) and the PC never went to sleep. I've also observed this over longer intervals as well, such as overnight.
- I have sleep mode enabled, of course
- "multimedia settings – When Sharing Media" is set to allow the computer to sleep.
- "powercfg -lastwake" show nothing of interest, since it never goes to sleep and can't wake up.
- "powercfg /requests" shows 3 entries – all "[DRIVER] ?". I assume that 2 of these are my mouse and keyboard – as I've recently used them to run the powercfg command. I'm at a loss for the third though.
- I've unhooked all USB peripherals save for my keyboard and mouse.
- Wake on LAN is disabled in my BIOS.
- I know that you can disable all apps from waking/preventing sleep – but I want the ability to remain for those apps that do legitimately need to keep the system awake.
So; does anyone know of a way to figure out what the 3rd phantom "[DRIVER] ?" is in powercfg /requests?
Best Answer
Bingo. I found it. An ISO mounting utility I ran had a file mounted and opened across the network. Apparently if a file is open for read across the network, Windows is prevented from sleeping.
On another note - I discovered a little quirk with the
powercfg
utility. It seems to make a difference what type of terminal you run it from. Running under cygwin and Console2 gave false and erratic reports from the program (including acould not load energy.dll
error from runningpowercfg -ENERGY
). At first I thought the issues with[DRIVER] ?
were just a matter of the program not having sufficient information to determine the driver; but it was really a symptom of being executed under a standardcmd.exe
terminal.As Emory points out in the comment below, the cause of this odd behavior is that
powercfg
requires elevated permissions - requiring that it be run as Administrator. There is no warning built in to the program to alert the user, it will just return incorrect output (and possiblycould not locate energy.dll
in the case ofpowercfg -ENERGY
). It must be run from a command prompt with elevated privileges.Sooo... long story short... to determine what program is keeping your system from sleeping:
cmd.exe
with administrative privileges (this is key,powercfg
will run under anything, but will give incorrect results)powercfg -requests
to get a listing of items currently preventing sleep.I was able to determine that files open across the network were preventing sleep in my case.