Friday, June 3, 2011

VB script to view system serial number

Copy the below code and save it as filename.vbs extension. then execute it

ComputerName = InputBox("Enter the name of the computer you wish to query")
winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""
'WScript.Echo winmgmt1
Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")
for each SN in SNSet
        MsgBox "The serial number for the specified computer is: " & SN.SerialNumber

No comments: