Recipes by topic

Serial number and BIOS version

Win32_BIOS holds the serial number and the BIOS version; Win32_ComputerSystem adds the manufacturer and the model.

$computerSystem = Get-CimInstance -ClassName Win32_ComputerSystem
$bios = Get-CimInstance -ClassName Win32_BIOS

[PSCustomObject]@{
    ComputerName = $computerSystem.Name
    Manufacturer = $computerSystem.Manufacturer
    Model        = $computerSystem.Model
    SerialNumber = $bios.SerialNumber
    BiosVersion  = $bios.SMBIOSBIOSVersion
    BiosDate     = $bios.ReleaseDate
}

ReleaseDate is a [datetime]. On a virtual machine or a custom-built motherboard, the serial number can be empty or hold a generic value from the board maker (for example To Be Filled By O.E.M.).

Variant: remote

To list the serial numbers of a fleet, the Win32_BIOS class is enough.

$cimSession = New-CimSession -ComputerName 'PC01', 'PC02'
try {
    $cimParameters = @{
        CimSession = $cimSession
        ClassName  = 'Win32_BIOS'
    }
    Get-CimInstance @cimParameters |
        Select-Object -Property PSComputerName, SerialNumber, SMBIOSBIOSVersion, ReleaseDate
} finally {
    Remove-CimSession -CimSession $cimSession
}

Classes used

← All recipes