Ever since last spring sometime my Windows Vista system would not blank the screen or go into sleep mode. I was rather busy with other things so just lived with it. I upgrade to Windows 7 a few months ago and still had the problem.

Time to put on my Windows programmer hat and figure out what’s wrong. I tried the following:

  • Running the powercfg diagnostics, which didn’t really find anything
  • Looked though the event logs
  • Activated and looked at some of the ETW trace event logs
  • Installed a 3rd party app that said it could display the seconds until display balking/sleep, which almost always showed idle time was zero
  • Used msconfig to deactivate ALL services and start-up group programs, no change
  • Booted to safe mode, it still would not blank the display/sleep

Sounds like it must be some critical driver preventing sleep, so hunted and found the pwrtest app in the WDK (tools\PowerManagemnt). Opening an elevated command prompt, changing to the tools\PowerManagement\amd64 directory and entering “pwrtest.exe /monitor” started a log on the console. Very interesting, almost every second, the idle timer was getting reset, who could be doing that. Perhaps it’s my UPS which I know is a HID device, and was installed about the same time as this problem started. I started to unplug USB devices, one by one, UPS, Scanner, Printer, Mouse, Keyboard. Wait, if I unplug the keyboard pwrtest shows the idle timer starts counting up, and the constant resets are gone. Hmm, this is an OLD Microsoft keyboard which I liked the feel of. It has both PS/2 and USB connectors. It seems, every second or so, this keybaord sends some sort of dummy character or status report, which resets the OS idle timer, prevening the screen saver/blanking or sleep from every happening. A quick swap of keyboards, and the problem was fixed. Hours of Internet searching had not found this root cause, so much for community support. I had better write something!