Get computer serial number and other info with PowerShell

To get the serial number from a computer run the following PowerShell command:

gwmi win32_bios | fl SerialNumber

To get more information e.g. bios version and manufacturer just run:

gwmi win32_bios

Comments (11)

  1. Martin Modin says:

    You can use Invoke-Command.
    E.g. Invoke-Command -ComputerName DC1 {Get-WmiObject win32_bios}

  2. Martin Modin says:

    georg do you have some kind of inventory system like SCCM? Then you can query it for the serial number.

  3. Martin Modin says:

    If you want to store it as a variable just do something like:
    $SN = gwmi win32_bios | Select-Object SerialNumber
    or if you just want to store the value:
    $SN = gwmi win32_bios | Select –ExpandProperty SerialNumber

  4. arockia says:

    very helpful

  5. coleman984 says:

    How do you do this for a computer over the network?

  6. Georg says:

    how can i find a Serialnummer in my domain.
    I have onla the seriennummer (hardware)

  7. Spencer says:

    If I wanted to then pass this to a variable in a script how would i go about that?

  8. Alexavius says:

    $currenttime = get-date
    $Results = @()

    Function Get-SerialNumber{


    $SerialNumber = Invoke-Command -ComputerName $computer {gwmi win32_bios | Select –ExpandProperty SerialNumber}
    $SerialNumber = "Not found"

    $CustomObject = new-object PSobject
    $CustomObject | add-member -membertype noteproperty -name "Computer_Name" -value $Computer
    $CustomObject | add-member -membertype noteproperty -name "SerialNumber" -value $null


    $CustomObject.SerialNumber = $SerialNumber



    write-host "Starting SerialNumber Lookup at $currenttime"

    Foreach ($computer in $computers){
    $onlinestatus = test-connection $computer -Count 1 -quiet
    if ($onlinestatus -eq $true)
    write-host "Starting SerialNumbers Lookup on $computer"

    Try{$Results += (Get-SerialNumber -Computer $Computer)}
    Catch{Write-Host "An error occured reading data from $computer; skipping"}
    write-host "$computer is Offline" -foregroundColor Red
    $Results | Export-CSV -Path $CSVOutputLocation -NoTypeInformation

  9. blake says:

    You can also use wmic:
    wmic bios get serialnumber