首页 > 代码库 > python wmi模块学习

python wmi模块学习

# -*- coding: cp936 -*-

import wmi

c = wmi.WMI ()

for sys in c.Win32_OperatingSystem():

        print "Version:%s" % sys.Caption.encode("UTF8"),"Vernum:%s" % sys.BuildNumber

        print  sys.OSArchitecture.encode("UTF8")#系统是32位还是64位的

        print sys.NumberOfProcesses #当前系统运行的进程总数

 

import wmi

wmi_instance=wmi.WMI(moniker="ROOT/WMI")

ret_instance=wmi_instance.query("Select * From MSAcpi_ThermalZoneTemperature")

for t in ret_instance:

    print t.InstanceName,"Current Temperature: ",(t.CurrentTemperature/10)-273.15

python wmi模块学习