How to Find the Serial Number of a Windows Machine using PowerShell

Automating Asset Management

When a Helpdesk technician is trying to troubleshoot a failing hard drive on an employee’s laptop, or when the IT purchasing department is conducting an annual hardware audit, they need the exact Serial Number (often called the Service Tag on Dell machines) of the physical computer. Asking a frustrated employee to flip their heavy laptop upside down and read a faded, microscopic sticker over the phone is rarely successful.

Instead of relying on the physical sticker, system administrators can use PowerShell to query the computer’s motherboard BIOS directly and instantly extract the factory-flashed Serial Number.

Using the Get-CimInstance Cmdlet

Hardware information is stored deep within the Windows Management Instrumentation (WMI) database. In modern versions of PowerShell, the most efficient way to query this database is using the Common Information Model (CIM) cmdlets.

To find the serial number of the machine you are currently working on, open PowerShell and execute the following command:

Get-CimInstance -ClassName Win32_BIOS

The output will be a brief table detailing the BIOS version, manufacturer, and the critical Serial Number.

SMBIOSBIOSVersion : 1.15.1
Manufacturer      : Dell Inc.
Name              : 1.15.1
SerialNumber      : 7B3XW92
Version           : DELL   - 1072009

Filtering the Output

If you are writing a script to populate an asset management database (like Snipe-IT or a custom SQL table), you do not want the entire table; you only want the raw alphanumeric string.

You can use the Select-Object cmdlet with the -ExpandProperty flag to strip away the formatting and isolate the raw data:

Get-CimInstance -ClassName Win32_BIOS | Select-Object -ExpandProperty SerialNumber

The output will now simply be: 7B3XW92.

Querying Remote Computers

The true power of PowerShell is remote execution. If you need the serial number of an executive’s laptop, you do not need to interrupt their work or log into their machine via Remote Desktop.

Assuming Windows Remote Management (WinRM) is enabled across your domain, simply append the -ComputerName parameter, followed by the hostname or IP address of the target machine.

Get-CimInstance -ClassName Win32_BIOS -ComputerName "EXEC-LAPTOP-01" | Select-Object -ExpandProperty SerialNumber

Auditing an Entire Organizational Unit (OU)

You can combine this CIM query with the Active Directory module to audit an entire department in seconds.

$Computers = Get-ADComputer -Filter * -SearchBase "OU=Sales,DC=corp,DC=contoso,DC=com"

foreach ($Computer in $Computers) {
    $Serial = (Get-CimInstance -ClassName Win32_BIOS -ComputerName $Computer.Name -ErrorAction SilentlyContinue).SerialNumber
    Write-Host "$($Computer.Name) : $Serial"
}

This script will ping every machine in the Sales OU, pull its serial number over the network, and print a clean, easily copy-pasteable list directly into your terminal.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.