In our labs, we have many Windows XP Professional computers that are supposed to be shut down in the evenings by a scheduled batch file. However, in the past, the shutdown process hadn't always been successful. I then discovered the reason why and came up with a remedy.

We use ALWIL Software's Avast! antivirus software on every client computer. The configuration prevents users from logging off when there's a disk (e.g., CD-ROMs, USB flash disks) in one of the computer's removable disk drives. I discovered that sometimes users leave for the day without logging off their computers and leave a disk in one of the removable disk drives. In this situation, the shutdown process fails and the computer is left on during the night.

I found simple remedy to this situation. I added one parameter to the Shutdown command in the scheduled batch file. Here's the content of this revised batch file:

Shutdown -s -f -m \\ip_address -t 0

The -s parameter specifies the shutdown process for the machine specified after the -m parameter (where ip_address is the machine's IP address). The -f parameter is the key component I added. It forces all applications to close, including Avast! The -t parameter specifies the time interval between issuing the Shutdown command the actual start of shutdown process.

To complete the configuration, I added the Shutdown command for every computer on new line in a text file and saved the file as batch file (.bat extension). On the server, in the Control Panel Scheduled Tasks applet, I pointed to the batch file, which I saved locally. In the account parameters, I used a user account with the appropriate rights to shut down remote computers. Note that this solution won't work when personal firewalls are enabled.

- Milos Puchta