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
Anonymous
December 09, 2013
very helpfulAnonymous
February 14, 2014
Helpful indeedAnonymous
July 02, 2014
How do you do this for a computer over the network?Anonymous
July 02, 2014
You can use Invoke-Command.
E.g. Invoke-Command -ComputerName DC1 {Get-WmiObject win32_bios}Anonymous
November 25, 2014
Or Get-WMIObject -Class Win32_BIOS -ComputerName DC1 | Format-List SerialNumberAnonymous
December 04, 2014
How you do this if you do not know all the computer names in a domain environment?Anonymous
April 10, 2015
Get-WmiObject -ComputerName myserver.corp.local -Class Win32_BIOSAnonymous
May 05, 2015
how can i find a Serialnummer in my domain.
I have onla the seriennummer (hardware)
thxAnonymous
May 05, 2015
georg do you have some kind of inventory system like SCCM? Then you can query it for the serial number.Anonymous
May 19, 2015
If I wanted to then pass this to a variable in a script how would i go about that?Anonymous
May 20, 2015
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 SerialNumberAnonymous
June 23, 2015
$currenttime = get-date
$Results = @()
Function Get-SerialNumber{
Param
(
[Parameter(Mandatory=$true)]
$Computer
)
Try{
$erroractionpreference="SilentlyContinue"
$SerialNumber = Invoke-Command -ComputerName $computer {gwmi win32_bios | Select –ExpandProperty SerialNumber}
}
Catch{
$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
IF($SerialNumber){
$CustomObject.SerialNumber = $SerialNumber
}
$CustomObject
}
write-host "Starting SerialNumber Lookup at $currenttime"
Foreach ($computer in $computers){
$erroractionpreference="SilentlyContinue"
$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"}
}
else
{
write-host "$computer is Offline" -foregroundColor Red
}
$Results | Export-CSV -Path $CSVOutputLocation -NoTypeInformation
}Anonymous
September 25, 2015
You can also use wmic:
wmic bios get serialnumberAnonymous
September 28, 2015
The comment has been removedAnonymous
October 04, 2016
good one!!Anonymous
March 16, 2017
$Hostnames = Get-Content C:\Users\rica.alivio\Desktop\SampleStations.txtGet-WmiObject -ComputerName $Hostnames -Class Win32_BIOS | Select -Property PSComputerName,SerialNumber > C:\Users\rica.alivio\Desktop\Output.txtAnonymous
May 04, 2017
How do i get server serial number using PowerShell or CMDAnonymous
June 07, 2017
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?Anonymous
October 26, 2017
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 kr82964@gmail.com How do i runPowersAnonymous
July 17, 2018
Thank you - worked perfectly!