Shutdown 4 PCs with 1 UPS
After replacing the main UPS here at the office this past weekend , I began to wonder if there were a way to shutdown more than 1 PC connected to the UPS. As most of you know, a UPS will come with a communications port to let the PC know the status of the UPS. This is done with a cable (RJ45 to USB in my case) plugged into the PC. This is how the PC knows when the UPS is on battery power, and how much battery charge/time is left. Once you have hooked the communications cable to the PC, you will see it under Power Options in Device Manager. There, you can set variables such as when to shut down the monitor and PC if they are running on battery backup.
This is great, but what if you have more than 1 PC on your UPS. They need to be shutdown as well, right? So, here’s the solution I found to shut down the 3 PCs I have plugged into my UPS. The only software you need is a small program called PowerOff.
“Poweroff is a small program for Windows to schedule a shutdown, reboot, logoff, poweroff, Standby, Hibernate, Lock, Wake-On-LAN at a certain time. Poweroff also supports command line options that allows poweroff to be used in batch scripts. It has a built-in scheduler, it allows you to run a program before doing the action, you can give a warning message to the user, wait for a process to finish before doing the action and full remote control is supported.”
Here’s what you need to do:
Part 1: Download, install and configure PowerOff on all PCs.
- Download and extract the current version of PowerOff. http://users.pandora.be/jbosman/pwroff30.zip
- Run PowerOff.exe, select Service from the menu bar and choose Create Service.
- Select Allow Remote Control and click on Settings.
- You can specify the port number where PowerOff listens for connections, or you can use the default 3210. Enter a password.5: On menu bar, select Service and choose Save settings to service.
Now, if you have a router, you will need to open port 3210. Without going into detail, you need to go into your routers settings, choose add a port, select Telnet as the protocall and choose 3210 as the port to foreward. Also, if you have a firewall, it needs to be configured to allow an exception for PowerOff. (This needs to be done on all the PCs.)
Part 2: Writing a script for the main PC
a. Open Notepad and copy this into it (This is setup for 4 PCs);
- poweroff poweroff -force -remote PC1 -port 3210 -password PASSWORD
- poweroff poweroff -force -remote PC2 -port 3210 -password PASSWORD
- poweroff poweroff -force -remote PC3 -port 3210 -password PASSWORD
- poweroff poweroff -force -remote PC4 -port 3210 -password PASSWORD
b. Replace PC1, PC2, … with the names of the computer to be shutdown. It is important to list the PC that is hosting this file to be the last on the list.
c. Replace PASSWORD with the password you used on each PC when setting up PowerOff.4: Save the file as shutdown.bat in your System32 folder. (usually C:WindowsSystem32).
Part 3: Configure Windows Power Options on Main PC
- Go to Control Panel and choose Power Options on the PC communicating with the UPS
- Select the Alarms tab and check Activate low battery alarm when power level reaches:
- Click on the Alarm Action button, check When the alarm occures, run this program, and click Configure Program.
- On the Task tab, click Browse… and choose the shutdown.bat file you created earlier.
- Click on Set Password if you need to enter a password when starting Windows, and enter the password. (This is different than the ones created for PowerOff).
- Click Apply, then OK to close.
To test the script, go to: Start, Run, and type “shutdowm.bat”. When you hit Enter, your PCs should shutdown.
Depending on the number of PCs connected to the UPS and the size of your monitor, you may want to adjust when the shutdown procedure is started. You dont want to run out of power before he last PC is stopped.