vbs获取硬件信息.vbs

strOut = "" 
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") 
'获取网卡的MAC地址 
Set colItems = objWMIService.ExecQuery _ 
("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") 
For Each objItem in colItems 
strOut = strOut & "MAC Address: " & objItem.MACAddress &vbcrlf 
msgbox strout
Next
'获取CPUID
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
strOut = strOut & "Processor ID: " & objItem.ProcessorId&vbcrlf
Next
'获取硬盘序列号
Set colDiskDrives = objWMIService.ExecQuery _ 
("Select * from Win32_DiskDrive")
For each objDiskDrive in colDiskDrives
strOut = strOut & "Signature: " & vbTab & objDiskDrive.Signature
Next
'建立一个IE对象,并利用它的功能巧妙的把输出字符串复制到剪贴版里.
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.document.parentwindow.clipboardData.SetData "text", strOut
objIE.Quit
Wscript.Echo strOut

你可能感兴趣的:(vbs获取硬件信息.vbs)