If you need to find the serial number for your computer or laptop, you do not need to look in the documentation or the manufacturer’s label on the case/motherboard. Windows can get your computer’s serial number from the BIOS. To get the serial number from the BIOS, query a specific class in the WMI namespace.
To find out the serial number of your computer from the command prompt, run the command:
wmic bios get serialnumber
This command returns the serial number of the computer.
You can also use PowerShell to view the serial number:
Get-WmiObject win32_bios | select Serialnumber
This command only works in Windows PowerShell up to version 5.1. If PowerShell Core 6.x/7.x is installed on the computer, you should use Get-CimInstance instead of Get-WmiObject.
Get-CimInstance win32_bios | select Serialnumber
CIM allows you to get a remote computer’s serial number.:
Get-CimInstance Win32_Bios -ComputerName WKS2112b -ErrorAction SilentlyContinue | Select-Object SerialNumber
If remote access to the CIM is disabled, you can use PowerShell Remoting (WinRM) to access the computer:
Invoke-Command -ComputerName WKS2112b -ErrorAction SilentlyContinue -ScriptBlock {Get-CimInstance Win32_Bios -ErrorAction SilentlyContinue | select SerialNumber}
You can get a list of serial numbers for all the computers in an Active Directory domain using the following PowerShell script:
$computers = Get-ADComputer -Filter {enabled -eq "true"}
Invoke-Command -ComputerName $computers.Name -ErrorAction SilentlyContinue -ScriptBlock {Get-CimInstance Win32_Bios -ErrorAction SilentlyContinue | select PSComputerName,SerialNumber}