Shut down all network computers via batch script?
Asked by
XOIIO (
18328)
August 23rd, 2011
Alright, so at y workplace all our stuff has battery back ups, so when the power goes out it can keep running until we shut it down. I was wondering if there is a batch script to shut down every single computer on the network, or a program to choose which one. It needs to be a free solution.
Observing members:
0
Composing members:
0
2 Answers
I recently did this because we had an issue with our Generator not cutting over.
Once the UPS runs out, hard loss of power will affect hard drives, system boards, cache batteries, etc for weeks after power is restored.
I put together a script that called psshutdown or WMIC for all Windows servers.
I did them in batches for controlling them (Critical Apps, Email Servers, ancillary, AD/GC/DC) in a better timing and order.
Be extra careful at who has the ability to execute these as you are talking about shutting down your environment. Put operation controls in place at when and how these are executed. Create password control so they are not inadvertantly or maliciously executed. PM me if you need more info.
Both are free.
WMIC commands
SysInternals psshutdown
All you need is a simple windows script. “shutdown -s -f -m \\%1 -t 00” paste that without the quotes in notepad and then save it as Shutdown.bat for example. Make sure to change the file extension to .bat
Then create another .bat file in notepad, call it MasterShutDown.bat for example. In the MasterShutDown file type “start shut.bat xxxx” without quotes. Where the xxxx is, put in the computer name for all the computers on your network. You should have long list that looks like below,
start shut.bat xxxx
start shut.bat xxxx
start shut.bat xxxx
start shut.bat xxxx
and so on…
By the end you should have two .bat files. When you want to shut down all the computers in one action double click the “MasterShutDown” bat file and it will reference the “ShutDown” file and shut down all your computers that are named in the file.
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.