VBS获取硬盘序列号

标签: , , , ,

VBS调用WMI获取硬盘序列号,没什么技术含量,核心是Win32_PhysicalMedia类。

'SerialNumber
'By Demon
'https://demon.tw
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMedia",,48)

Dim objItem 'as Win32_PhysicalMedia
For Each objItem in colItems
    WScript.Echo "SerialNumber: " & objItem.SerialNumber
Next

参考链接:http://msdn.microsoft.com/en-us/library/windows/desktop/aa394346%28v=vs.85%29.aspx

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. VBS真的能实现多线程?
  2. Raspberry Pi -bash: nslookup: command not found
  3. Unable to find the socket transport "ssl" – did you forget to enable it when you configured PHP?
  4. VBS学习心得
  5. WMI工具:WMI CIM Studio

留下回复