Simply get a UPS, I particularly like the ones from APC, and configure the alerts in the power management control panel application.
As you can see I have two separate VBS scripts configured, one to go off almost immediately the power goes out, and one to go off just before the server shuts down. Thus I will get an email as the power goes out, and another one as the server chooses to shut itself down because of lack of power.
The scripts are pretty easy.
For Windows Small Business Server with Exchange, the script is easy, because you have a mail server, ready to send mail on your behalf! Just copy and paste these text into a .vbs file:
Set MyMail = CreateObject("CDO.Message")
MyMail.From = "email@example.com"
MyMail.To = "firstname.lastname@example.org;email@example.com"
MyMail.Subject = "Power Outage Shutdown"
MyMail.TextBody = "Power not restored. Server shutting Down."
MyMail.Fields("urn:schemas:mailheader:X-MSMail-Priority") = 2
Set MyMail = Nothing
As you can see, I've put two email addresses in here. My email, and celluar text email, so I get an alert on my phone. :o)
For Windows Home Server without Exchange, you need to be a little more tricky, since you need to relay the message through your ISPs mail server. So the script is a little longer:
Const cdoSendUsingMethod = _
Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
Const cdoSMTPServerPort = _
Const cdoSMTPConnectionTimeout = _
Const cdoSMTPAuthenticate = _
Const cdoBasic = 1
Const cdoSendUserName = _
Const cdoSendPassword = _
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
' Get a handle on the config object and it's fields
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
' Set config fields we care about
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp.isp.net"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPConnectionTimeout) = 10
Set objMessage = CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
.To = "Your Name <firstname.lastname@example.org>"
.From = "Home Server <email@example.com>"
.Subject = "Power Outtage"
.TextBody = "The Power has gone out @ " & Now()
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
Simply choose the script that's best for you scenario, and hook it up to the power alerts.
E-Mail when a server shuts itself down.. doesn't get much better then that!