输入序列号查找计算机名称

时间:2017-07-06 09:15:43

标签: vbscript wmi serial-number

我有这个脚本,可以通过输入计算机名来搜索计算机序列号。你能帮我扭转一下吗?那么它会通过输入序列号找到计算机名称吗?

MyHostName = InputBox("Enter Machine Name")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
                    MyHostName & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure")
For Each objSMBIOS In colSMBIOS    
    pn = "Part Number: " & objSMBIOS.PartNumber
    sn = "Serial Number: " & objSMBIOS.SerialNumber
    sn1 = objSMBIOS.SerialNumber
    an = "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
Next
tmp = InputBox(pn & VBCrLf & sn  & VBCrLf & an, "Computer Serial Number", sn1)

0 个答案:

没有答案