VBS Script – Get Computer Serial Number Remotely

The following script can be used to remotely access the serial number for a computer on your network.

It works with Windows 7 and Windows 10.

How to use the script?

When you run the script it will prompt for the computer name:

VBS-GetSerialNumber1

After entering the computer name and pressing ‘OK’ it will return the part number, serial number and asset tag (if saved to the system BIOS).

The serial number is presented in a text box which allows you to copy and paste it into another window.

VBS-GetSerialNumber2

VBS Script:

Download

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)