S.l.e!ep.¢%

像打了激速一样,以四倍的速度运转,开心的工作
简单、开放、平等的公司文化;尊重个性、自由与个人价值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

vbs获取硬件信息.vbs

Posted on 2011-04-20 11:49 S.l.e!ep.¢% 阅读(528) 评论(0)  编辑 收藏 引用 所属分类: VBScript
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

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理