Saturday, July 23, 2011

Remote Shutdown

Hello Again!  It's been over a year since my last post on this blog and what a year it has been.  It is a hot and steamy day here and so I thought I would work on a little project that has been in the hopper since January.


The project is to have a program shut down a specific list of computers in the building I work in.  There are about 76 rooms with computers that are supposed to be shut down at the end of each day, sometimes the end user forgets and the machine is left on overnight, the weekend, or the vacation weeks.  I wanted the ability to shutdown these specific rooms remotely, and even better yet, kick off a script at 5PM each night that tells each one to shut down.  The theory behind the script is if the machine is on, then it will shutdown, if off, no harm done.


The program I wrote reads a list from a text file and initiates a remote shutdown of each machine.  If you are interested in using it I am making it available to all.  You can download a zip file which contains the executable and a required MS library.  Extract the two files to a folder on your computer and your just about ready to go.


ShutdownWorkstation.exe is the file you will want to execute, but before you do, there is one parameter, that is the name of the file that contains the list of workstations that you want to shutdown.  Create a text file and enter the names of the workstations you want to remotely shutdown.  After the name of each workstation press enter. Save the file, preferably in the same folder as the one where the ShutdownWorkstation.exe file is.


Your ready to go.  Fire up the command prompt, change to the folder where the ShutdownWorkstation executable is and type:


        ShutdownWorkstation [name of file with list]


Press enter and see what happens.  


You can download the program at http://www.secureresearch.com/ShutdownWorkstation.zip

You may get errors. The two most common I've seen are 5 and 53.  Error 5 means access denied.  You need to have permission to remotely shutdown the workstation, try doing it as a domain administrator.  Error 53 usually means it is either an invalid computer name, the computer name could not be resolved, or the computer is already off.  

0 comments:

Post a Comment