PowerShell Serial Number Lookup: A Practical Guide
Learn how to retrieve BIOS and motherboard serial numbers with PowerShell. This guide covers local and remote lookups, CIM vs WMI, and reliable verification practices.

To answer what is the powershell command to get the serial number, use PowerShell CIM/WMI queries. Typical commands include: `(Get-CimInstance -ClassName Win32_BIOS).SerialNumber` and `Get-WmiObject Win32_BIOS | Select-Object SerialNumber` for local machines. For motherboard serials, run `Get-CimInstance -ClassName Win32_BaseBoard | Select-Object SerialNumber`. These approaches work on Windows PowerShell and PowerShell Core.
what is the powershell command to get the serial number
This section answers the core question in plain terms and shows the typical PowerShell commands used to retrieve hardware serial numbers. The exact keyword phrase appears here to align with search intent: what is the powershell command to get the serial number. The recommended approach is to query the CIM or WMI interfaces exposed by Windows hardware drivers. In many environments, the BIOS serial is exposed via the Win32_BIOS class, while the motherboard serial is exposed via Win32_BaseBoard. The two core commands below demonstrate how to fetch each value. Before running these commands, ensure you have the necessary privileges on the local machine or remote hosts.
# Local BIOS serial
(Get-CimInstance -ClassName Win32_BIOS).SerialNumber
# Local motherboard serial
(Get-CimInstance -ClassName Win32_BaseBoard).SerialNumber# Quick one-liner (expand if needed)
(Get-CimInstance -ClassName Win32_BIOS).SerialNumberwhat is the powershell command to get the serial number
This section provides a deeper dive into the same commands, clarifying when to use CIM vs WMI. CIM is the modern, cross-platform approach, while WMI remains compatible on older systems. The SerialNumber property is the value you typically want, but not every device exposes it in the same class. If a value is missing, you may be dealing with a VM, a hardware platform that masks identifiers, or restricted permissions.
# Alternative: using WMI (older approach)
(Get-WmiObject -Class Win32_BIOS).SerialNumber# Expand properties and handle nulls gracefully
$bios = Get-CimInstance -ClassName Win32_BIOS
$serial = if ($null -ne $bios.SerialNumber) { $bios.SerialNumber } else { 'N/A' }
Write-Output $serialSteps
Estimated time: 15-25 minutes
- 1
Assess local vs remote scope
Decide whether you are querying the local machine or a remote endpoint. Remote lookups require credentials, firewall rules, and CIM/WMI permission. If you’re just validating assets on one computer, local lookup is quickest.
Tip: Start with a local query to verify access before attempting remote sessions. - 2
Choose the CIM approach
Prefer Get-CimInstance for modern PowerShell and cross-platform compatibility. If CIM is unavailable, fall back to the WMI cmdlets, keeping in mind Windows-specific constraints.
Tip: CIM is more efficient and supports remote sessions more robustly. - 3
Run a BIOS serial lookup locally
Execute a BIOS serial query and validate the output. Compare BIOS and BaseBoard results to understand which serial identifiers are exposed on your hardware.
Tip: Use -ExpandProperty to simplify parsing when only the string is needed. - 4
Perform a remote lookup securely
Establish a CIM session with credentials, run the query, then close the session. Ensure network policies permit WinRM/WSMan traffic if using PowerShell Remoting.
Tip: Always terminate sessions to avoid security risks. - 5
Parse, format, and log results
Convert results to CSV or JSON for asset management. Validation can help detect blank fields or inconsistent identifiers across devices.
Tip: Export with NoTypeInformation for clean CSV output.
Prerequisites
Required
- Required
- Administrative privileges for WMI/CIM accessRequired
- Basic familiarity with PowerShell syntax and objectsRequired
Optional
- Target computer(s) accessible on the network for remote lookups (if needed)Optional
- Optional: PowerShell Remoting enabled for remote CIM sessionsOptional
Commands
| Action | Command |
|---|---|
| Get BIOS serial locallyPowerShell 7+ on Windows, macOS, or Linux with CIM enabled | Get-CimInstance -ClassName Win32_BIOS | Select-Object SerialNumber |
| Get motherboard serial locallyUseful when BIOS does not expose the board serial directly | Get-CimInstance -ClassName Win32_BaseBoard | Select-Object SerialNumber |
| One-liner BIOS serialSimplifies output to a single string | (Get-CimInstance -ClassName Win32_BIOS).SerialNumber |
| Remote BIOS serial (authenticated)Requires network access and valid credentials | $session = New-CimSession -ComputerName 'SERVER' -Credential (Get-Credential); (Get-CimInstance -ClassName Win32_BIOS -CimSession $session).SerialNumber |
| Remote BIOS serial (older WMI path)Backwards-compatible for legacy environments | Get-WmiObject -Class Win32_BIOS -ComputerName 'SERVER' | Select-Object SerialNumber |
Frequently Asked Questions
Can PowerShell always fetch a serial number from any device?
No. Some devices or virtualization environments may not expose a serial number, or may hide it behind vendor-specific interfaces. Always validate against the actual hardware and use fallback methods when necessary.
Not always. Some devices don’t expose a serial number, or use vendor-specific interfaces that PowerShell can't access.
Which class should I query for BIOS vs motherboard serials?
BIOS serials come from Win32_BIOS, while motherboard serials come from Win32_BaseBoard. Use Get-CimInstance with these classes to retrieve the respective SerialNumber properties.
BIOS uses Win32_BIOS; motherboard uses Win32_BaseBoard.
Is CIMSession required for remote lookups?
CIMSession is the recommended approach for remote lookups because it keeps a persistent, authenticated connection. You can also use one-off queries with -ComputerName, but sessions are more scalable for multiple targets.
Yes, CIMSession is recommended for remote lookups.
What if the serial number is blank or shows 'N/A'?
A blank or N/A serial often indicates virtualization, a system where the vendor blocks the value, or a missing driver. Verify on the physical device or check alternative identifiers in inventory records.
If it’s blank, you may be dealing with a VM or blocked identifier.
Can I extract multiple serials across a fleet in one go?
Yes. Build a list of hostnames, initiate CIM sessions in a loop, and collect results into a structured object or CSV. Parallelization should be used cautiously to avoid overwhelming the network.
Yes, you can fetch many serials at once with careful scripting.
Does PowerShell Core behave differently on Linux/macOS?
PowerShell Core supports CIM/WMI on non-Windows platforms via Open Management Infrastructure (OMI) or platform-specific equivalents. Some classes may be unavailable or behave differently, so test on your target OS.
Core support varies; test on your platform.
Key Takeaways
- Use Get-CimInstance for BIOS and motherboard serials locally.
- Prefer CIM sessions for remote lookups with proper credentials.
- Handle null results gracefully and verify hardware limitations.
- Export results to CSV/JSON for asset management and audits.
- WMI remains a fallback for legacy environments.