hi
I am looking a script that will shutdown a small selection of computers. I would prefer it if the script looked at a text file to define the computers rather having the computer names in the script.
Does anyone have one please?
Z

hi
I am looking a script that will shutdown a small selection of computers. I would prefer it if the script looked at a text file to define the computers rather having the computer names in the script.
Does anyone have one please?
Z

Try this one does it by text file or OU and logs any errors:
Redmond | Column: Shut Down, Already
Last edited by SYNACK; 21st June 2008 at 10:14 PM.
Run -> CMD -> shutdown -i -> Browse -> find computers -> Add note -> shutdown
Hope this helps



you can no longer download the tool!

Here is is as a code listing, you will need to copy it and paste it into a text file called shutdownrestart.wsf
Best Practice 97 - Shutdown Shutdownrestart.wsf
PSshutdown - [ Part of the Admin Bar ]
we use psshutdown its one of the best tools we have found see below
PsShutdown from sysinternals (Now part of Microsoft)
download from
PsShutdown
Initiate a shutdown/reboot of a local or remote computer, logoff a user, lock a system.
Syntax
psshutdown [[\\computer[,computer[,..] | @file [-u user [-p passwd]]]
-s|-r|-h|-d|-k|-a|-l|-o
[-f] [-c] [-t nn|h:m] [-n s] [-v nn]
[-e [u|p]:xx:yy] [-m "message"]
Options:
computer The computer on which the user account resides. Default=local system
a wildcard (\\*), will affect all computers in the current domain.
-p passwd Specify a password for user (optional). Passed as clear text.
If omitted, you will be prompted to enter a hidden password.
-u user Specify a user name for login to remote computer(optional).
@file Execute the command on each of the computers listed in the file.
-a Abort a shutdown (only possible while a countdown is in progress)
-c Allow the shutdown to be aborted by the interactive user
-d Suspend the computer
-e [u|p]:xx:yy
Shutdown reason code, 'u' = user, 'p'= planned shutdown.
xx is the major reason code (must be less than 256)
yy is the minor reason code (must be less than 65536)
-f Force all running applications to exit during the shutdown
instead of giving them a chance to gracefully save their data.
-h Hibernate the computer
-k Poweroff the computer (reboot if poweroff is not supported)
-l Lock the computer
-m "message" Specify a message to logged-on users when a shutdown countdown commences
-n Timeout in seconds connecting to remote computers
-o Logoff the console user
-r Reboot after shutdown
-s Shutdown without poweroff
-t Countdown in seconds until the shutdown (default: 20 seconds)
or the time of shutdown (in 24 hour notation)
-v Display message for the specified number of seconds before the shutdown.
default= display a shutdown notification dialog,
specifying a value of 0 results in no dialog.
- Help, display the supported options.
This tool allows administrators to create a batch file that will run against multiple computers to perform a mass change of the administrator password.
Examples:
Reboot \\workstation64 as part of an OS upgrade
psshutdown \\workstation64 -r -e p:2:3
Related Commands:
SHUTDOWN - With full list of reason codes
Equivalent Linux BASH command:
shutdown - Shutdown or restart linux

just put all the computer names in computer.txtCode:@echo off cls echo Shutting Down Computers... if not exist computers.txt goto NOTFOUND FOR /F %%i in (computers.txt) do shutdown -s -m \\%%i goto END :NOTFOUND echo computers.txt not found GOTO END :END echo Done...
tosh74 (26th June 2008)
I miss GOTO commands.....
I hated having to port some of my older batch type stuff into loops......
Still, thats life.

@Zak: PM me, I have a home-made tool I'd like you to beta if that's ok.
Could someone post a script to shutdown PCs using psshutdown? It keeps hanging when I try it - I try to give a warning, then shutdown and log it all to a log file (2003 & XP)
There are currently 1 users browsing this thread. (0 members and 1 guests)