strcomputer = "."
objwmiservice = getobject("winmgmts:\\" || strcomputer || "\root\CIMV2")
colitems = objwmiservice~execquery("SELECT * FROM Win32_ComputerSystem")
DO objitem OVER colitems
IF objitem~powermanagementcapabilities \== "" THEN SAY objitem~powermanagementcapabilities
SAY "PowerManagementSupported:" objitem~powermanagementsupported
SELECT objitem~powerstate
WHEN 1 THEN strpowerstate = "Full Power"
WHEN 2 THEN strpowerstate = "Power Save - Low Power Mode"
WHEN 3 THEN strpowerstate = "Power Save - Standby"
WHEN 4 THEN strpowerstate = "Power Save - Unknown"
WHEN 5 THEN strpowerstate = "Power Cycle"
WHEN 6 THEN strpowerstate = "Power Off"
WHEN 7 THEN strpowerstate = "Power Save - Warning"
OTHERWISE strpowerstate = "Unknown"
END
SAY "PowerState:" strpowerstate
SELECT objitem~powersupplystate
WHEN 1 THEN strpowersupplystate = "Other"
WHEN 3 THEN strpowersupplystate = "Safe"
WHEN 4 THEN strpowersupplystate = "Warning"
WHEN 5 THEN strpowersupplystate = "Critical"
WHEN 6 THEN strpowersupplystate = "Non-recoverable"
OTHERWISE strpowersupplystate = "Unknown"
END
SAY "PowerSupplyState:" strpowersupplystate
END |