Shutting down Windows

Post date: 29-Apr-2011 08:50:01

May 1st, 2007

My kids like to play games on my personal laptop which happens to have WinXP Home on it. Of course they don’t like to get off it when it’s time for dinner, bed, bathing, school, … Going in there and making them shut it down can be a challenge.

So the solution a mash-up Apache and psshutdown now available from Microsoft. My apache was installed through cygwin so I have all the shell powers available for my cgi scripts.

Just make some cgi scripts and off we go.

You will need to make a dummy script to accept the licence using the /accepteula switch which needs to be run once or the scripts will just all fail.

I added the sysinternals tools to my system environment path so they will get picked up without addng the path.

Then the following script is dropped into

/srv/www/cgi-bin/shutdown

#!/bin/sh

# disable filename globbing

set -f

echo “Content-type: text/plain; charset=iso-8859-1″

echo

echo Force shutdown of computer

echo

psshutdown -kf

I also set up a static IP address for the laptop.

Now I just put a bookmark in my browser http://192.168.1.199/cgi-bin/shutdown and clicking on this shuts that laptop down without any arguments.

I have Wi-Fi capable mobile phone so put the bookmark in there and I can easily shut it down from there too, which is really handy as I’m not always in front of a computer screen.