wmi查询——vbs

运行“webmtest”--连接 命名空间“root\cimv2”,枚举类别--超类别信息 递归 -- 双击 win32_processor ,查看可用属性

'远程计算机取信息定义值
set objLocator=createobject("wbemscripting.swbemlocator")

strComputer = "."
'msgbox userpass&username&ip

set wmi=objLocator.connectserver(strComputer,"root/cimv2")
'set wmi=objLocator.connectserver(strComputer,"root/cimv2",username,userpass)

'取计算机名称
set computer=wmi.execquery("select * from win32_computersystem")
For each objcomputer in computer
msgbox objcomputer.name

next

set cpus= wmi.execquery("select * from win32_processor")
for each cpu in cpus
msgbox cpu.level & " " & cpu.manufacturer
next

set ldrives= wmi.execquery("select * from win32_LogicalDisk where drivetype = 3")
for each ldrive in ldrives
msgbox ldrive.deviceid & ldrive.freespace
next

posted on 2013-05-19 14:08  momingliu11  阅读(575)  评论(0编辑  收藏  举报