SynopsisGets the serial number of a local or remote computer.
- Get-Serial [ComputerName] [-PreserveWhitespace] [-Credential]
DescriptionThe Get-Serial cmdlet returns the serial number stored in the BIOS of a local or remote computer.
- 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.
InputsGet-Serial accepts pipeline input only for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.
OutputsGet-Serial outputs the serial number of the requested computer as a system.string.
NotesThe 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 1This command will retrieve the serial number of the local computer:
Example 2This command will retrieve the serial number of the remote computer PC01:
C:\PS>Get-Serial -Computer PC01
Example 3This 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