I currently have a Windows 2003 Server connected to an APC Smart UPS via USB, I also have a Windows 2008 SBS server powered by the UPS. Is there a way of shutting both servers down using the APC Powerchute software on the event of a power failure.

Any suggestions would be great!
SCOTT78Technical AdvisorAsked:
Who is Participating?
meade470Connect With a Mentor Commented:
Create a shutdown.cmd file shown below: and place it in the "c:\Program Files\APC\PowerChute Business Edition\agent\cmdfiles" directory. Name it shutdown.cmd

cscript shutdown.vbs

Open in new window

Create a shutdown.vbs shown below, containing:

'   safety feature - I commented it out for now, but
'   you might want to UN-comment it later
On Error Resume Next

'   declare variables & constants
Const ForReading = 1
Const strPCFile = "shutdown_computers.txt"

'   create the file system object
Set fso = CreateObject("Scripting.FileSystemObject")

'   Read all the text in one shot.
Set f = fso.OpenTextFile(strPCFile, ForReading) 
text = f.ReadAll

'   then close the text file

'   Split to an array. The delimiter is the CR+LF pair.
arrText = split(text, vbNewLine)

'   then start to iterate through the list - ping each one first to make sure it's there
For Each strPC in arrText
  strComputer = strPC

  '   FIRST connect to the WMI Namespace of the remote machine
  Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  	If objWMIService Then 
  	' Set up the shell to ping the remote machine
  	Set objShell = CreateObject("WScript.Shell")

  	' Use the shell to execute the ping command
  	Set shellExec = objShell.Exec("ping -n 2 -w 1000 " & strComputer)

  	'Capture the ping reply in a string in lower case format
  	strPingResults = LCase(shellExec.StdOut.Readall)

  		If InStr(strPingResults, "reply from") Then
        	Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
        		For Each objOperatingSystem in colOperatingSystems
	    		'WScript.Echo strComputer & " was rebooted..."   
		 End If

  		If Instr(strPingResults, "timed") Then
       		'WScript.Echo strComputer & " Is Not Online!!!"

			End If
 		End If 
	If Instr(strPingResults, "check the name") Then
		'wscript.Echo strPC & " is not a valid name!!!"
	End If 

Open in new window

Create a .txt file called: "shutdown_computers.txt" and place it in the same directory the shutdown.vbs and .cmd files are in.

Example for shutdown_computers.txt:


Open in new window

Then open powerchute, when asked for the command file, point to the .cmd file in the cmdfiles directory.
I believe you need PowerChute Network Shutdown.  http://www.apc.com/tools/download/software_comp.cfm?sw_sku=SFPCNS223&id  I'm using it here but the "master" UPS is connected to the LAN, which it uses to communicate with other servers that it can command to shutdown remotely in case of an extended power outage.  I'm not positive you can do it with your setup though.  
OK, it looks like Powerchute Network Shutdown requires a network management card.  So my answer doesn't work for you.
>Is there a way of shutting both servers down using the APC Powerchute software on the event of a power failure.

No, you need the version of APC hardware designed for networks, not the USB one - USB is designed for a single host.
I find many users asking the same question but no "canned" solution.  It's possible to do it with custom scripting, where the server with the USB connection to the UPS sends a shutdown command to the other system(s).  Here's some discussion on one approach:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.