This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Get-Serial

Synopsis

Gets the serial number of a local or remote computer.

Syntax

  • Get-Serial [ComputerName] [-PreserveWhitespace] [-Credential]

Description

The Get-Serial cmdlet returns the serial number stored in the BIOS of a local or remote computer.

Parameters

  • ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
  • PreserveWhitespace Return the serial number unaltered, with any whitespace preserved. By default the cmdlet strips whitespace (spaces and blanks) from the serial number. Some manufacturers pad serial numbers with whitespace when writing them to the BIOS. This causes the serial number to fail comparisons operations in Powershell. However, to retain the whitespace and return the serial number exactly as stored, use this switch.
  • Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.

Inputs

Get-Serial accepts pipeline input only for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.

Outputs

Get-Serial outputs the serial number of the requested computer as a system.string.

Notes

The Get-Serial cmdlet requires that the RPC service is started on the computer it is trying to access and that DNS services are available to resolve target host names.

Example 1

This command will retrieve the serial number of the local computer:

C:\PS>Get-Serial

Example 2

This command will retrieve the serial number of the remote computer PC01:

C:\PS>Get-Serial -Computer PC01

Example 3

This command will retrieve the serial number of the remote computer PC01 and also preserve any spaces, padding or blank characters included within the serial number:

C:\PS>Get-Serial -Computer PC01 -PreserveWhitespace