Retrieving Computer Serial Number Using PowerShell

Power shell, Command power shell, Command get serial numberl

To find the serial number of your computer using PowerShell, you can use the Get-WmiObject command. This command leverages the Win32_BIOS class to fetch information about the BIOS, including the serial number.

Command to Retrieve Serial Number

Here is the PowerShell command to get the serial number of your computer

Get-WmiObject -Class Win32_BIOS | Select-Object -Property SerialNumber

Explanation:

  • Get-WmiObject: This cmdlet retrieves instances of WMI classes.
  • -Class Win32_BIOS: Specifies the WMI class to query, which in this case is Win32_BIOS.
  • Select-Object -Property SerialNumber: Selects and displays only the SerialNumber property from the retrieved WMI object.

Example Output

When you run the above command, you will get an output similar to this:

SerialNumber

------------

1234-5678-90AB-CDEF

Alternative Command

You can also use the Get-CIMInstance command to achieve the same result:

Get-CIMInstance -ClassName Win32_BIOS | Format-List SerialNumber

Explanation:

  • Get-CIMInstance: This cmdlet retrieves management information from local and remote computers.
  • -ClassName Win32_BIOS: Specifies the CIM class to query, which is Win32_BIOS.
  • Format-List SerialNumber: Formats the output as a list, displaying the SerialNumber property.

Exporting Serial Number to a Text File

If you need to export the serial number to a text file, you can use the following command:

Get-WmiObject -Class Win32_BIOS | Select-Object -Property SerialNumber > C:\ComputerSerial.txt

Explanation:

  • > C:\ComputerSerial.txt: Redirects the output to a text file located at C:\ComputerSerial.txt.

Use Cases

Knowing your computer’s serial number can be useful in various scenarios, such as:

  • Creating an inventory of devices.
  • Contacting technical support for troubleshooting.
  • Ordering replacement parts.
  • Checking warranty information.

By using these PowerShell commands, you can quickly and efficiently retrieve the serial number of your computer without needing to access the BIOS or look for a physical sticker on the device.

Source Data :

  1. shellgeek.com
  2. windowscentral.com
  3. howtogeek.com


Leave a Reply

Your email address will not be published. Required fields are marked *