怎么在WIN7下正确读出硬盘物理序列号
发布网友
发布时间:2022-02-23 08:28
我来回答
共1个回答
热心网友
时间:2022-02-23 09:57
以下语句可以成功读出硬盘序列号,但在WIN7下没有试验是否可行:
Local oWMI As Object,oLocal As Object,oHARDWARE As Object,object1 As Object,lcCPUID,LcMAC,lcHDID,lcSerial,lcIP
oWMI=Createobject("WbemScripting.SWbemLocator")
oLocal=oWMI.ConnectServer(".", "root\cimv2")
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_PhysicalMedia")
For Each object1 In oHARDWARE
lcHDID=object1.Properties_('SerialNumber').Value
Exit
Endfor