[python-win32] Trying to get the Win32_PortableBattery and Win32_SystemEnclosure classes to work

python at bdurham.com python at bdurham.com
Mon Mar 8 03:38:32 CET 2010


I'm trying to get the Win32_PortableBattery and
Win32_SystemEnclosure classes to work.

Oddly enough, both classes return empty results on my laptop. I'm
wondering if I'm using the WMI interface correctly or if I need
to be more explict in the arguments I pass to each class's
__init__?

Here are my results from Python 2.6.4 (32-bit) run on a Sony Vaio
laptop with Windows 7 Professional (64-bit):

>>> import wmi
>>> c = wmi.WMI().Win32_SystemEnclosure
>>> c
<_wmi_class: \\SONYLAPTOP-01\ROOT\cimv2:Win32_SystemEnclosure>

>>> c()
[<_wmi_object:
\\SONYLAPTOP-01\root\cimv2:Win32_SystemEnclosure.Tag="System
Enclosure 0">]

>>> c()[0]
<_wmi_object:
\\SONYLAPTOP-01\root\cimv2:Win32_SystemEnclosure.Tag="System
Enclosure 0">
>>> c()[0].properties
{u'HotSwappable': None, u'SKU': None, u'SerialNumber': None,
u'Width': None, u'SecurityBreach': None, u'Removable': None,
u'PartNumber': None, u'AudibleAlarm': None, u'Status': None,
u'TypeDescriptions': None, u'Description': None,
u'NumberOfPowerCords': None, u'Replaceable': None,
u'LockPresent': None, u'SecurityStatus': None,
u'BreachDescription': None, u'Manufacturer': None,
u'OtherIdentifyingInfo': None, u'Version': None, u'Name': None,
u'InstallDate': None, u'ServiceDescriptions': None,
u'VisibleAlarm': None, u'PoweredOn': None, u'ServicePhilosophy':
None, u'SMBIOSAssetTag': None, u'Caption': None, u'Depth': None,
u'Model': None, u'HeatGeneration': None, u'Weight': None,
u'ChassisTypes': None, u'Height': None, u'Tag': None,
u'CableManagementStrategy': None, u'CreationClassName': None,
u'CurrentRequiredOrProduced': None}

-AND-

>>> c = wmi.WMI().Win32_PortableBattery
>>> c
<_wmi_class: \\SONYLAPTOP-01\ROOT\cimv2:Win32_PortableBattery>

>>> c()
[]

>>> c.properties
{u'BatteryStatus': None, u'PowerManagementSupported': None,
u'ManufactureDate': None, u'MaxRechargeTime': None,
u'SystemName': None, u'Location': None, u'CapacityMultiplier':
None, u'Status': None, u'TimeToFullCharge': None, u'PNPDeviceID':
None, u'Description': None, u'ConfigManagerUserConfig': None,
u'ErrorCleared': None, u'MaxBatteryError': None, u'Manufacturer':
None, u'Name': None, u'InstallDate': None, u'DesignVoltage':
None, u'EstimatedChargeRemaining': None, u'Caption': None,
u'StatusInfo': None, u'DeviceID': None,
u'ConfigManagerErrorCode': None, u'PowerManagementCapabilities':
None, u'Chemistry': None, u'TimeOnBattery': None,
u'ExpectedLife': None, u'DesignCapacity': None,
u'SmartBatteryVersion': None, u'ErrorDescription': None,
u'Availability': None, u'LastErrorCode': None,
u'CreationClassName': None, u'EstimatedRunTime': None,
u'FullChargeCapacity': None, u'SystemCreationClassName': None}

BTW: I get similar (empty) results when I run the equivalent
non-wmi module code (win32com.client based) for the above WMI
classes from the following script collection:

http://www.thescriptlibrary.com/Default.asp?Action=Browse&Level=C
ategory2&ScriptLanguage=Python&Category1=Scriptomatic&Category2=C
IMV2

Any suggestions appreciated.

Thank you,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100307/c91fc1d9/attachment.html>


More information about the python-win32 mailing list