So, I've found 2 different options. I too have an APC UPS powering 2 computers with PowerChute, but I had to uninstall it to get this first solution to work. I also had to uninstall the APC drivers for the battery backup and use the builtin Windows drivers. You could use this as a shutdown script in PowerShell:
Code:
if ((Get-WmiObject Win32_Battery).BatteryStatus -eq 1) {Stop-Computer -ComputerName "yourRemoteComputer" -Force}
I'm sure the above could be converted to use WMIC instead of powershell, but I leave that up to you
The second solution is posted on the APC forums, but I didn't test it.
http://forums.apc.com/thread/9055
In my case, neither option really works since my switches are not on a battery backup, just my PCs.
Hope that helps.
--Russel
edit
for kicks, I converted the above PowerShell into a batch file that uses WMIC. It should run faster than the PowerShell variant:
Code:
@echo off
for /f "usebackq skip=1 eol=" %%i in (`wmic path win32_battery get BatteryStatus`) do (
for /f "tokens=1 delims=:" %%j in ("%%i") do (
if %%j == 1 (
echo Battery is discharging
shutdown /s /m \\computername
)
)
)