Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Checking Laptop battery info

by stonecolddevin (Vicar)
on Jul 10, 2006 at 20:59 UTC ( #560234=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Checking Laptop battery info
in thread Checking Laptop battery info

well it's most certainly a start. if nothing else i can be like, "hey dad, check this out" :-)

might even be able to play around with it and see what the problem is with the percentages...

meh.


Comment on Re^3: Checking Laptop battery info
Re^4: Checking Laptop battery info
by Anonymous Monk on Dec 07, 2007 at 16:08 UTC
    For Windows scripting checkout Scriptomatic 2.0 from the microsoft scripting guys...
    use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my $computer = "localhost"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\roo +t\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Battery" +, "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "Availability: $objItem->{Availability}\n"; print "BatteryRechargeTime: $objItem->{BatteryRechargeTime}\n"; print "BatteryStatus: $objItem->{BatteryStatus}\n"; print "Caption: $objItem->{Caption}\n"; print "Chemistry: $objItem->{Chemistry}\n"; print "ConfigManagerErrorCode: $objItem->{ConfigManagerErrorCode}\n +"; print "ConfigManagerUserConfig: $objItem->{ConfigManagerUserConfig} +\n"; print "CreationClassName: $objItem->{CreationClassName}\n"; print "Description: $objItem->{Description}\n"; print "DesignCapacity: $objItem->{DesignCapacity}\n"; print "DesignVoltage: $objItem->{DesignVoltage}\n"; print "DeviceID: $objItem->{DeviceID}\n"; print "ErrorCleared: $objItem->{ErrorCleared}\n"; print "ErrorDescription: $objItem->{ErrorDescription}\n"; print "EstimatedChargeRemaining: $objItem->{EstimatedChargeRemainin +g}\n"; print "EstimatedRunTime: $objItem->{EstimatedRunTime}\n"; print "ExpectedBatteryLife: $objItem->{ExpectedBatteryLife}\n"; print "ExpectedLife: $objItem->{ExpectedLife}\n"; print "FullChargeCapacity: $objItem->{FullChargeCapacity}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "LastErrorCode: $objItem->{LastErrorCode}\n"; print "MaxRechargeTime: $objItem->{MaxRechargeTime}\n"; print "Name: $objItem->{Name}\n"; print "PNPDeviceID: $objItem->{PNPDeviceID}\n"; print "PowerManagementCapabilities: " . join(",", (in $objItem->{Po +werManagementCapabilities})) . "\n"; print "PowerManagementSupported: $objItem->{PowerManagementSupporte +d}\n"; print "SmartBatteryVersion: $objItem->{SmartBatteryVersion}\n"; print "Status: $objItem->{Status}\n"; print "StatusInfo: $objItem->{StatusInfo}\n"; print "SystemCreationClassName: $objItem->{SystemCreationClassName} +\n"; print "SystemName: $objItem->{SystemName}\n"; print "TimeOnBattery: $objItem->{TimeOnBattery}\n"; print "TimeToFullCharge: $objItem->{TimeToFullCharge}\n"; print "\n"; } sub WMIDateStringToDate(strDate){ return "blah"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://560234]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-12-20 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls