Monday, March 12, 2012

Microsoft Windows 7 Will Not Enter Sleep Mode : Find out Why

Windows 7 Not Going to Sleep when Idle

Determining What Applications are the Cause

I recently ran into a situation where my Windows 7 Ultimate x64 desktop computer appeared to be randomly not going into sleep mode when there was no activity. Normally, my system would enter sleep mode when idle for 30 minutes per the power settings I had specified through Control Panel / Power Options / Edit Plan Settings / Put the Computer to Sleep : 30 minutes.

But, somewhere along the line, something had apparently changed on my computer in a way that prevented the computer from going to sleep. Windows 7 had always entered sleep mode predictably before, so what happened? Luckily, this is pretty easy to figure out thanks to a command-line tool called powercfg.

Running the powercfg tool

You will want to open up a command prompt as an administrator. From the Windows Start menu, you can select "All Programs" and navigate to Accessories from within which you can choose "Command Prompt" and right-click and select "Run as Administrator". Once the command line interface / terminal-window appears, just type: powercfg /requests.

You should see output like the following, with various categories (DISPLAY, SYSTEM, AWAYMODE) under which any offending items will appear.


c:\>powercfg /requests
DISPLAY:
None.

SYSTEM:

[DRIVER] \FileSystem\rdbss
A file has been opened across the network. File name: [\NASDEVICE\VSS\data\loggedin\usernamehere.log] Process ID: [4388]

AWAYMODE:
None.


It turned out that my Windows 7 system was not going to sleep because of the fact "A file has been opened across the network". Instantly I knew what the issue was: the output of the powercfg command clearly identified the offending file(s), which I recognized as belonging to my VSS (Visual SourceSafe) version-control application.

Simple enough, right?

The funny thing was that I had been using VSS for ages on this particular Windows7 desktop, but I must not have left it running in the evening before, and thus never noticed that it prevented Windows from entering sleep mode.  Now I know, and now I make sure to close the VSS UI every evening if I plan to leave my computer turned on with the intention of it going to sleep properly and as expected.

No comments: