How to find the serial number of a Windows computer using Powershell?

We all need to share the serial number of the computer at some point in time. Powershell and command prompt can be used to find the serial number of the computer easily. You can always flip your notebook upside down to find the serial number as it is embossed at the bottom of the laptop. I prefer to use the Powershell or command prompt for getting the serial number on the Windows computer.

For this task, we will use Powershell to get to the serial number using one of the existing Powershell directives.


Use WMI Object to find the serial number on the Windows computer

WMIObject uses the win32_bios class to fetch the serial number details of the computer. You can find the serial number of the local computer or a remote computer through WMI Object. Here is the WMIObject Powershell directive that can be used to find the serial number on the computer.

Get-WMIObject win32_bios | Select SerialNumber

The command output of this command is displayed below in the form of a screenshot. You can see that the output has been filtered to provide the serial number of the Windows computer. The Win32_bios class shares multiple attributes of the system.

Serial number of WIndows computer using WMIObject command on Powershell

Use CimInstance to find serial number of the computer in Powershell

We can also make use of the CimInstance command directive in Powershell and get the serial number of the computer. The command to find the serial number of a computer using CimInstance is shared below:

Get-CIMInstance win32_bios | Format-list SerialNumber

CIMInstance also uses the win32_bios class to fetch system details. We use the format_list qualifier to qualify the output of the command to only include the serial number of the computer. The output from this command is displayed hereunder as a screenshot:

If desired, you can redirect the command output to a file rather than displaying it on the screen. For this, you will need to create a file and ensure it is writable. The command can be qualified to send the output of the command to the file.

The following command will find the serial number of the local computer and place the output in a text file named sn.txt.

Get-CIMInstance win32_bios | Format-list SerialNumber > d:\serialnumber\sn.txt

You can use CIMinstance on a local computer to fetch system details. You can connect to a remote computer using PSExec and then run the CIMInstance on win32_bios for finding the system details, including the serial number of the computer.


Using CIMInstance to find the serial number of a remote Windows computer using Powershell

We can use the CIMinstance command to find the serial number of a remote computer. We still use the win32_bios class for fetching the serial number information of the computer. However, we will alter the directive to include the computer name of the remote computer. However, you need to ensure that Powershell remoting is supported on the remote computer and WinRM is running on the destination computer.

Here is the command that can fetch the serial number of a remote computer:

Get-CIMInstance win32_bios -ComputerName SYSTEM-01 | Format-list SerialNumber

We have included the computer name option and the name of the remote computer to get the serial number of the remote computer. The command above will find the serial number of a remote computer with the computer name SYSTEM-01.


Using WMIC to find the serial number of the Windows computer in Powershell

WMIC command is universally available in Powershell and Windows command prompt. You can use the wmic command in Powershell or the command prompt environment. The result of the output will contain the serial number of the computer.

Here is the wmic command to get the serial number of a computer.

wmic bios get serialnumber

The command output of this command will list the serial number of the computer. The command output is displayed below for your ready reference as a screenshot:

WMIC command to find serial number of computer

You can export the output to a file as well. In that case, the command will need to be qualified as under:

wmic bios get serialnumber > c:\computerdetails\serialnumberfile.txt

For the command to work seamlessly, the file and path information should be correct. In the case shared above, we are fetching the serial number of the computer and placing it in a file under the path c:\computerdetails\serialnumberfile.txt.

Suggested Powershell Tutorials

We suggest reading the below given Powershell tutorials for performing functions and tasks on Windows computers:

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Rajesh Dhawan

Rajesh Dhawan is a technology professional who loves to blog about smart wearables, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.