Get PC Serial Number from Registry

biosregeditserial numbervbscript

I'm trying to get the serial number of a user's PC from a VBS script, and display it in a msgbox. I am aware of the methods for commandline (wmic bios getserialnumber) and I am aware of the hardware-based methods (like looking at the sticker or the box.) I have checked the registry (HKLM\HARDWARE\DESCRIPTION\System\BIOS) to no avail. How can I use VBS (without calling a batch file) to display a users serial number?

I am moreso looking for a location in the registry for the serial number, I can work the script around that, I just need to know where to look

Best Answer

Here is the VBScript code to find the Serial number of the machine you are using:

    strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_ComputerSystemProduct") 
For Each objItem in colItems 
    msgbox "This Device: " & objItem.IdentifyingNumber, vbOkayOnly, "Serial Number"
Next

This will make a msgbox that displays the serial number in standard format. Thank you all for your help

Related Question