I need to learn serial number of a computer. How can I do this with PowerShell. I was using wmic bios get serialnumber but its deprecated and removed on windows 11.
- Note that the degree to which any method to get the SN works is affected by the information provided by the manufacturer which may vary from product to product. trusting OEMs to fill out fields can be hit-or-miss.Frank Thomas– Frank Thomas2025-08-27 16:27:23 +00:00Commented Aug 27 at 16:27
3 Answers
The PowerShell equivalent to wmic.exe is Get-CimInstance; you can also use its alias gcim (in the PS console; aliases shouldn't be used in scripts).
Working with Get-CimInstance requires the WMI class name, though, while your command uses one of the aliases that wmic.exe offers. To find the class that an alias actually uses, you can use wmic.exe alias list brief, and then filter that for the alias:
wmic.exe alias list brief | Select-String BIOS -SimpleMatch This will show the actual query as Select * from Win32_BIOS.
So the full PowerShell command (to be used in a script) would be:
Get-CimInstance -ClassName Win32_BIOS For a quick query in the console, use the alias and omit the named parameter:
gcim Win32_BIOS Either of which could be piped to Select-Object -ExpandProperty SerialNumber or its shorter version select -expa serial*. But since the default output only shows 5 properties anyway, that might not even be required for you.
But Get-ComputerInfo for a simple WMI query is overkill; that gets a lot of other information that you're throwing away again.
- Thanks
gcim Win32_BIOSis easy to remember and type.mustafa candan– mustafa candan2025-08-28 08:30:48 +00:00Commented Aug 28 at 8:30
I use get-computerinfo | select biosseralnumber.
Or just get-computerinfo and scroll down a little, if I am not scripting. Its a lot easier to type and memorize.
- 1
(get-computerinfo).biosseralnumberalso works.LPChip– LPChip2025-08-27 07:38:10 +00:00Commented Aug 27 at 7:38
This will return the motherboard (PCB) S/N:
Get-CimInstance Win32_BaseBoard | Select SerialNumber Or using the compact syntax:
(Get-CimInstance Win32_BaseBoard).SerialNumber - This gives me a different SN than the other two answers, but if I replace Win32_Baseboard with Win32_BIOS both yield the expected value.Dallas– Dallas2025-09-02 21:39:33 +00:00Commented Sep 2 at 21:39
- 1@Dallas
Win32_BaseBoardcontains the serial number of the motherboard (as asked in the question), andWin32_BIOSthe BIOS serial number. One is tied to the hardware, the other to the firmware. I don't expect them to be the same.Velvet– Velvet2025-09-03 05:40:01 +00:00Commented Sep 3 at 5:40