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 (14)

  1. anonymouscommenter says:

    very helpful

  2. anonymouscommenter says:

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

  3. Martin Modin says:

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

  4. anonymouscommenter says:

    Or Get-WMIObject -Class Win32_BIOS -ComputerName DC1 | Format-List SerialNumber

  5. anonymouscommenter says:

    How you do this if you do not know all the computer names in a domain environment?

  6. anonymouscommenter says:

    Get-WmiObject -ComputerName myserver.corp.local -Class Win32_BIOS

  7. anonymouscommenter says:

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

  8. Martin Modin says:

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

  9. anonymouscommenter says:

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

  10. 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

  11. anonymouscommenter 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

  12. anonymouscommenter says:

    You can also use wmic:
    wmic bios get serialnumber

Skip to main content