Most manufacturers of PC equipment incorporate an electronic serial number into their hardware. This makes it easy for inventory systems to gather and track machines by their serial numbers. You may find a need to obtain a PC’s serial number in your script. If WMI has the serial number in its data, this script will retrieve it for you. If not, it returns "
'
' Gets the serial number for the PC hardware
'
function getPCSerialNumber(strComputer)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystemProduct",,48)
theValue = ""
For Each objItem in colItems
theValue = objItem.IdentifyingNumber
Next
getPCSerialNumber = theValue
end function
