Thursday, February 28, 2008

Disabling automatic Windows logout

Today, my IT department set my Windows desktop up to automatically lock up and require entry of my password after an idle timeout. No big deal -- this sort of thing happens all the time and is, of course, usually blamed on Sarbanes-Oxley.

Well, for me it was a slightly bigger deal for a couple of reasons:
  1. My Windows desktop actually runs under my Linux desktop. It's a virtual machine running under VMWARE.
  2. Although IT advertised the timeout as 60 minutes, in reality, it was closer to 10 for me.
After a lengthy email exchange, I finally got IT to admit it is really a technical issue -- they need to lock down all the desktops on the domain, they (for some reason) can't distinguish virtual ones from real ones, and that's the way it is. (No word on why the timeout is so short, though.)

Obviously, technical issues call for technical solutions. Here's mine. By the way, it would be very unethical to use this on a "real" Windows desktop as opposed to a virtual one :)

All these steps should be taken inside the Windows VM. If you have a fast internet connection, you should be set up in under 5 minutes:

  1. Run the installer for Python:

  2. Run the installer for SendKeys:

  3. Save the following Python script to a file:

  4. import time
    from SendKeys import SendKeys

    while 1:
    print "Did it again"

  5. Run the file, e.g. by double-clicking on it.

This script will virtually press the caps lock key twice on the window with the focus, once every 5 minutes. Adjust to taste. You can minimize it after you run it, you can run it at startup, etc.

I have to admit that the idea of using the caps lock key is not original with me. I saw it somewhere, but I cannot remember where at the moment. Anyway, it works great, even when the key is pressed while you are typing.

No comments: