主题:十余行代码读出你的硬盘、CPU及网卡序列号
*!* 十余行代码读出你的硬盘、CPU及网卡序列号
*!* 如果是WIN98系统,将需要从 MSDN 下载并安 WMI
LOCAL oWMI AS OBJECT,oLocal AS OBJECT,oHARDWARE AS OBJECT,object1 AS OBJECT,lcCPUID,LcMAC,lcHDID,lcSerial
oWMI=CREATEOBJECT("WbemScripting.SWbemLocator")
oLocal=oWMI.ConnectServer(".", "root\cimv2")
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_Processor")
FOR EACH object1 IN oHARDWARE
lcCPUID=object1.Properties_('ProcessorId').VALUE
EXIT
ENDFOR
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_PhysicalMedia")
FOR EACH object1 IN oHARDWARE
lcHDID=object1.Properties_('SerialNumber').VALUE
EXIT
ENDFOR
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=1")
FOR EACH object1 IN oHARDWARE
LcMAC=object1.Properties_('MACAddress').VALUE
EXIT
ENDFOR
?'CPU序号:',lcCPUID
?'硬盘序号:',lcHDID
?'网卡MAC地址:',LcMAC
*!* 如果是WIN98系统,将需要从 MSDN 下载并安 WMI
LOCAL oWMI AS OBJECT,oLocal AS OBJECT,oHARDWARE AS OBJECT,object1 AS OBJECT,lcCPUID,LcMAC,lcHDID,lcSerial
oWMI=CREATEOBJECT("WbemScripting.SWbemLocator")
oLocal=oWMI.ConnectServer(".", "root\cimv2")
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_Processor")
FOR EACH object1 IN oHARDWARE
lcCPUID=object1.Properties_('ProcessorId').VALUE
EXIT
ENDFOR
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_PhysicalMedia")
FOR EACH object1 IN oHARDWARE
lcHDID=object1.Properties_('SerialNumber').VALUE
EXIT
ENDFOR
oHARDWARE=oLocal.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=1")
FOR EACH object1 IN oHARDWARE
LcMAC=object1.Properties_('MACAddress').VALUE
EXIT
ENDFOR
?'CPU序号:',lcCPUID
?'硬盘序号:',lcHDID
?'网卡MAC地址:',LcMAC