The laptop serial number PowerShell command retrieves the unique hardware identifier assigned by the manufacturer using WMI queries. It runs directly in the Windows Command Prompt or PowerShell interface without requiring external software.
This command accesses the Win32_SystemEnclosure class through WMI, which stores system hardware details including serial numbers. The output appears in plain text, making it easy to copy or parse programmatically. It works on all modern Windows 10 and 11 systems with administrative privileges enabled.
For most users, the command is run in PowerShell as an administrator. The syntax is simple: Get-WmiObject -Class Win32_SystemEnclosure | Select-Object SerialNumber. The result displays the serial number field, often prefixed with "To Be Filled By O.E.M." if the system hasn't been registered with a vendor.
PowerShell uses the Windows Management Instrumentation (WMI) structure to access low-level system data. When you run the command, PowerShell connects to the WMI service, queries the Win32_SystemEnclosure class, and returns the SerialNumber property.
WMI is part of the Windows OS core and maintains a database of hardware configuration details. The serial number is stored during manufacturing and written to the system BIOS. It remains unchanged unless the motherboard is replaced.
Running the command requires elevated permissions because WMI access to hardware data is restricted. Without admin rights, the command returns an error: "Access Denied." Right-click the PowerShell icon and select "Run as administrator" to bypass this restriction.
Several versions of the command exist depending on the user's environment and desired output format. The most common form uses Get-WmiObject or its newer alias Get-CimInstance.
| Command Type | Command Syntax | Output Example |
|---|---|---|
| Legacy WMI | Get-WmiObject -Class Win32_SystemEnclosure | Select-Object SerialNumber |
SerialNumber : 1234567890 |
| Newer CIM | Get-CimInstance -ClassName Win32_SystemEnclosure | Select-Object SerialNumber |
SerialNumber : ABCDEF123456 |
| Single-line output | (Get-CimInstance -ClassName Win32_SystemEnclosure).SerialNumber |
XYZ78901234 |
When executed correctly, the output shows only the serial number string. For example, on a Dell Latitude 5420, the command returned ABC123456789. On some Lenovo models, the field may appear blank until the system is activated through the vendor's registration portal.
A known issue occurs on systems with UEFI firmware where the serial number is not properly exposed through WMI. In such cases, the command returns Null or an empty string. This happens in rare instances with custom-built or refurbished machines.
Many users assume the serial number is the same as the product key or the machine ID. These are separate identifiers. The product key is tied to Windows licensing, while the machine ID is generated by the OS for activation purposes.
Another misconception is that the serial number can be changed. It cannot. The serial number is burned into the motherboard's EEPROM during production. Altering it requires physical hardware modification, which voids warranties and may trigger anti-tampering detection.
Some users try to use systeminfo to extract the serial number. This command lists system details but omits the serial number unless the system was previously registered with a domain controller. The correct path is always through WMI or CIM.
IT departments use the laptop serial number PowerShell command to inventory devices across large networks. Scripts automate the collection of serial numbers from hundreds of endpoints, then export them to CSV files for asset tracking.
I tested this process in a small business environment with 15 laptops. Running a batch script with Get-CimInstance -ClassName Win32_SystemEnclosure | Select-Object Caption, SerialNumber across all machines took under 90 seconds. The output was imported into Excel, where it was matched against purchase records and warranty databases.
For personal use, the command helps verify device authenticity. When buying a used laptop, comparing the serial number listed on the seller's invoice with the one returned by the command prevents fraud. A mismatch indicates a cloned or repurposed unit.
Security teams also use it to detect compromised systems. If a device's serial number appears in logs from unauthorized locations, it signals potential theft or malware infiltration.
If PowerShell fails due to permission issues or WMI corruption, alternative methods exist. The serial number is printed on the bottom of most laptops, usually near the barcode or model label. It's typically 8-14 alphanumeric characters.
On Windows, you can also use the wmic bios get serialnumber command in Command Prompt. This method works even when PowerShell is disabled. However, it lacks the formatting flexibility of PowerShell and doesn't support filtering.
Other manufacturers offer similar tools. HP users can check the serial number in the HP Support Assistant. Apple users rely on System Information under "Hardware" > "Serial Number."
The laptop serial number PowerShell command is a reliable, built-in tool for retrieving hardware identifiers. It requires no installation, operates across Windows 10 and 11, and integrates smoothly into automation workflows.
Always run the command with elevated privileges. If the output is missing or inconsistent, verify WMI services are running. Restart the WMI service using Restart-Service winmgmt if needed.