Skip to content

Instantly share code, notes, and snippets.

@liantian-cn
Created May 27, 2018 12:23
Show Gist options
  • Save liantian-cn/d69a02f3cb6844301bb1c4d57fba2f6b to your computer and use it in GitHub Desktop.
Save liantian-cn/d69a02f3cb6844301bb1c4d57fba2f6b to your computer and use it in GitHub Desktop.
python wmimonitorid SerialNumberID
for obj in objWMI:
if obj.Active != None:
print("Active:" + str(obj.Active))
if obj.InstanceName != None:
print("InstanceName:" + str(obj.InstanceName))
if obj.ManufacturerName != None:
print("ManufacturerName:" + str(obj.ManufacturerName))
if obj.ProductCodeID != None:
print("ProductCodeID:" + str(obj.ProductCodeID))
if obj.SerialNumberID != None:
print("SerialNumberID:" + str(obj.SerialNumberID))
print("SerialNumberID:" + ''.join(chr(i) for i in obj.SerialNumberID))
print("")
print("########")
print("")
@liantian-cn
Copy link
Author

from win32com.client import GetObject
objWMI = GetObject('winmgmts:\\.\root\WMI').InstancesOf('WmiMonitorID')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment