Tony Giangreco
asked on
Windows 2003 Remote Shutdown Script
We have three servers in or network (1-2008, 2-2003). The UPS software that performs the automated shutdown in case of a power failure didn't work quick enough yesterday when we had a power outage. I was not there to manually shut them down and two went down hard before the UPS shutdown completed.
I have a restart script that use for remote maintenance and just modified it for shutdown instead of restart. I've put it on the server 2008 desktop for the office mgr to use incase of an emergency. Now I'd like to create a script she can execute to manually shutdown the two other servers.
Here is a quick script that runs on the 2008 server.
cd\
net stop "AeLookupSvc" /y
net stop "AppHostSvc" /y
net stop "QuickBooksDB20" /y
net stop "QBCFMonitorService" /y
net stop "Spooler" /y
....
shutdown /s /t /30 /f /d /p:4:1
I have a shutdown file very simular to this on the two 2003 servers in the domain. How do I automate the remote shutdown of both of them from the 2008 server properly?
I have a restart script that use for remote maintenance and just modified it for shutdown instead of restart. I've put it on the server 2008 desktop for the office mgr to use incase of an emergency. Now I'd like to create a script she can execute to manually shutdown the two other servers.
Here is a quick script that runs on the 2008 server.
cd\
net stop "AeLookupSvc" /y
net stop "AppHostSvc" /y
net stop "QuickBooksDB20" /y
net stop "QBCFMonitorService" /y
net stop "Spooler" /y
....
shutdown /s /t /30 /f /d /p:4:1
I have a shutdown file very simular to this on the two 2003 servers in the domain. How do I automate the remote shutdown of both of them from the 2008 server properly?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry, i missed a parameter in shutdown
sc \\server2 "AeLookupSvc" stop
sc \\server2 "AppHostSvc" stop
....
shutdown /m \\server2 /s /t 30 /f /d /p:4:1
sc \\server2 "AeLookupSvc" stop
sc \\server2 "AppHostSvc" stop
....
shutdown /m \\server2 /s /t 30 /f /d /p:4:1
sorry, another error, I should sleep a little more today...
sc uses server command service syntax
sc \\server2 stop "AeLookupSvc"
sc \\server2 stop "AppHostSvc"
....
shutdown /m \\server2 /s /t 30 /f /d /p:4:1
sc uses server command service syntax
sc \\server2 stop "AeLookupSvc"
sc \\server2 stop "AppHostSvc"
....
shutdown /m \\server2 /s /t 30 /f /d /p:4:1
if your server aren't in a domain, you can use psexec command using username and pass for the destination server.
the script could be like this
psexec \\server2 -u server2\username - p password net stop "AeLookupSvc" /y
psexec \\server2 -u server2\username - p password net stop "AppHostSvc" /y
psexec \\server2 -u server2\username - p password net stop "QuickBooksDB20" /y
psexec \\server2 -u server2\username - p password net stop "QBCFMonitorService" /y
psexec \\server2 -u server2\username - p password net stop "Spooler" /y
....
psexec \\server2 -u server2\username - p password shutdown /s /t 30 /f /d /p:4:1
the script could be like this
psexec \\server2 -u server2\username - p password net stop "AeLookupSvc" /y
psexec \\server2 -u server2\username - p password net stop "AppHostSvc" /y
psexec \\server2 -u server2\username - p password net stop "QuickBooksDB20" /y
psexec \\server2 -u server2\username - p password net stop "QBCFMonitorService" /y
psexec \\server2 -u server2\username - p password net stop "Spooler" /y
....
psexec \\server2 -u server2\username - p password shutdown /s /t 30 /f /d /p:4:1
ASKER
Hi serchlop,
I will schedule network downtime next week and try this out. I need to be onsite to manually the servers back on.
I will schedule network downtime next week and try this out. I need to be onsite to manually the servers back on.
If your servers support wake on lan, you can use free wolcmd tool to start them remotely, you should enable in routers or communication hardware.
ASKER
I tried this on Friday but had problems with the syntax. My maintenance window closed. I will try again this week.
Ok, I use the following command to wake up a server in my company
Syntax
WolCmd.exe MAC IP NetworkMask PortWakeOnLAN
in another power on server I run
WolCmd.exe 001111222233 10.0.1.17 255.255.255.0 7
change 001111222233 for your MAC Address for your NIC in server you want to start
change 10.0.1.17 for the ip for your server
Syntax
WolCmd.exe MAC IP NetworkMask PortWakeOnLAN
in another power on server I run
WolCmd.exe 001111222233 10.0.1.17 255.255.255.0 7
change 001111222233 for your MAC Address for your NIC in server you want to start
change 10.0.1.17 for the ip for your server
ASKER