|I am trying to make scripts that will execute when the system is on UPS or Battery Power. It will run on a Windows 2008 server when I am done. I have tried the following code found at:|
Dim psBattery As PowerStatus = SystemInformation.PowerStatus
Dim perFull As Single = psBattery.BatteryLifePercent
'Show the remaining battery power in percentages
MsgBox("Total battery power remaining: " & perFull * 100 & "%")
'Is the battery charging?
If psBattery.PowerLineStatus = PowerLineStatus.Online Then
MsgBox("Battery charge status: Charging")
ElseIf psBattery.PowerLineStatus = PowerLineStatus.Offline Then
MsgBox("Battery charge status: Not charging")
But it blows up on Line 1 char 15 saying it is expecting an end of statement.
Any help would be appreciated.