Tuesday, August 7, 2012

Setting up a standard UPS to send power alerts

You need to install powershell on the server you are using:



Next you need to allow unsigned scripts to do this:

C:\powershell.exe set-ExecutionPolicy unrestricted

To verify you can view the setting

C:\powershell.exe get-ExecutionPolicy  

Install your UPS and configure your power settings then modify your initial alert to run a batch file at 50% battery life:

Here is an example batch file “PowerAlertEmail.bat”

powershell.exe c:\scripts\PowerAlertEmail.ps1


Here is an example “PowerAlertEmail.ps1” Script

## Define the variables for smtp server, from address, to address, subject and message body

$emailFrom = administrator@domain.com

$emailTo = power@domain.com

$subject = "ALERT – Building 1 Possible Power Outage Onsite Batteries < 50%" $body = "Power Outage- Battery Backups Below 50% reconnect power immediately or servers will be shut down shortly"

$smtpServer = ""

## Initiate sending a message to the IT group.

Then setup your UPS to run the PowerAlertEmail.bat when the battery reaches <50%


Shared Credit: Tim Lewis

No comments:

Post a Comment