VBS Script – Get Serial Number Remotely

The following script can be used to get remotely get the following information from a Windows computer-

  • Part Number
  • Serial Number
  • Asset Tag
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
    an = "Asset Tag: " & objSMBIOS.SMBIOSAssetTag
  Next
tmp = InputBox (pn & VBCrLf & sn  & VBCrLf & an,"Computer Details",sn)