Windows – Obtaining the serial number of a device

Here’s the thing, I have worked at a fair few organisations in my time as an IT guy and all bar one have had their own naming convention for Hostnames.

This is fine for asset management and the like, but there are times when you still need to get hold of the manufacturers BIOS serial number as this is what may be required for support. So how do we get hold of it? From the label on the device I hear you cry and you would be right. When the analogue route is not an option, worn out labels, device not easily physically accessible, we can always throws some script it the problem.

It is possible to achieve the same result different ways, in this article I will be demonstrating how to do it with both the command line and Powershell.

Command Line

One line will do it:

wmic bios get serialnumber

A straightforward two line response is returned:

Get Serial Number from the Command Line

We can extend this to querying s remote device on the same network using the /NODE: switch:

wmic /NODE {computername} bios get serialnumber

The output format as the same.


Again, as single line of code will get what we need:

Get-WMIObject -classname win32_BIOS serialnumber | select serialnumber

Similarly, a two line response is received:

Get Serial Number using PowerShell

The select statement at the end has been added to only return the serial number as that is all we require. As with the command line, we can also send this command to a remote device:

Get-WMIObject -classname Win32_BIOS -computername {computername} | select serialnumber

Oh, if you are feeling up to it, you could always read the label on the hardware, but who wants to be mucking around under peoples desks!