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

  13. jsam316 says:

    Awesome. God bless

  14. IT says:

    $Hostnames = Get-Content C:\Users\rica.alivio\Desktop\SampleStations.txt
    Get-WmiObject -ComputerName $Hostnames -Class Win32_BIOS | Select -Property PSComputerName,SerialNumber > C:\Users\rica.alivio\Desktop\Output.txt

  15. Tony says:

    How do i get server serial number using PowerShell or CMD

  16. Jonathan Jørgensen says:

    Can the last script be tinkered into getting serialnumber in WinPE (through powershell), and adding the text at the right spot in unattend.xml, so naming the pc with example TK-%serialnumber% right before the machine reboots and parses the unattend.xml?

  17. KAREN SCOTT says:

    i need to know what the name of my model and the serial number for my computer. There is a label on the bottom of my laptop. hellHowever, it has faded I can no longer read it. i can barely see Yoga 2 11. That is all i know. i need a cord for my adapter. Thank you for your help. karen Scott phone #740-360-2192. email How do i runPowers

  18. Travis says:

    Thank you – worked perfectly!

Comments are closed.

Skip to main content