- How to find computer serial number
- Author:
- COMMUNITY SOLUTIONS CONTENT DISCLAIMER
- SUMMARY
- How to find computer serial numbers on Windows 10
- How to determine PC serial number using PowerShell
- How to determine PC serial number using Command Prompt
- More Windows 10 resources
- The Dell XPS 15 is our choice for best 15-inch laptop
- Halo: MCC’s live service elements make it better, not worse
- Microsoft’s Surface Duo is not ‘failing up’
- These are the best PC sticks when you’re on the move
- WMIC : get Bios serial number
- How to get a serial number of a Windows disk?
- 2 Answers 2
- Getting Windows serial number (was: Getting MachineGuid from Registry)
- 3 Answers 3
How to find computer serial number
Author:
Yuval Sinay MVP
COMMUNITY SOLUTIONS CONTENT DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED «AS IS» WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.
SUMMARY
The following article will help you to find the computer serial number
Please use one the method bellow to retrieve the computer serial number:
1. Using the buid in » wmic» command:
» wmic bios get serialnumber«
Tip: You can use the command » wmic csproduct get name» to retrieve the local computer model.
How to find computer serial numbers on Windows 10
Source: Windows Central
On Windows 10, the ability to check the computer serial number can come in handy in many scenarios. For instance, when you need to create an inventory of the devices connected to your home network or organization, or need to contact technical support to troubleshoot a problem, order a replacement part, or check the warranty information.
Usually, you can find the required information on the sticker affixed on the back or bottom of your laptop or desktop, or checking the Basic Input/Output System (BIOS) or Unified Extensible Firmware Interface (UEFI) on your motherboard. However, if the sticker isn’t available or you don’t want to go through extra steps to access firmware, you can also use PowerShell and Command Prompt to retrieve this information quickly on Windows 10.
In addition, using commands can be useful to automate the process using a script when you need to retrieve the serial information from multiple devices.
In this Windows 10 guide, we’ll walk you through the steps to quickly find your device serial number using command lines.
How to determine PC serial number using PowerShell
To retrieve the serial number of your computer with a PowerShell command, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
Type the following command to find out the computer serial number and press Enter:
Get-WmiObject win32_bios | select Serialnumber
Source: Windows Central
(Optional) Type the following command to determine device serial number and press Enter:
Get-CIMInstance win32_bios | format-list SerialNumber
(Optional) Type the following command to export the serial information to a text file and press Enter:
Get-WmiObject win32_bios | select Serialnumber > PATH\TO\EXPORT
In the command, make sure to replace «PATH\TO\EXPORT» with the path to the text file you want to export the serial number information.
For example, this command exports the output to the ComputerSerial.txt file in the C drive:
Get-WmiObject win32_bios | select Serialnumber > C:\ComputerSerial.txt
Source: Windows Central
Once you complete the steps, you’ll know the serial number of your desktop or laptop computer.
If you are using the command to export the output, you’ll find the file in folder location you specified. Also, since you exported it as a text format, you can open it with Notepad or any other text editor.
How to determine PC serial number using Command Prompt
To check the device serial number using a Command Prompt command, use these steps:
- Open Start.
- Search for PowerShell, right-click the top result, and select the Run as administrator option.
Type the following command to find out the computer serial number and press Enter:
wmic bios get SerialNumber
Source: Windows Central
(Optional) Type the following command to export the serial information to a text file and press Enter:
wmic bios get SerialNumber > PATH\TO\EXPORT
In the command, make sure to replace «PATH\TO\EXPORT» with the path to the text file you want to export the serial number information.
For example, this command exports the output to the ComputerSerial.txt file in the C drive:
wmic bios get SerialNumber > C:\ComputerSerial.txt
Source: Windows Central
After you complete the steps, the command will return the serial number without needing to access the BIOS or going behind the device to look for the sticker.
Although these commands will work on any computer, custom-build devices don’t have a serial number. This means that the command output may read «To Be Filled By O.E.M.»
If you’re looking to retrieve the device model number, you can use these instructions.
More Windows 10 resources
For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:
The Dell XPS 15 is our choice for best 15-inch laptop
For a lot of people, a 15-inch laptop is a perfect size that offers enough screen for multitasking, and in a lot of cases, some extra performance from powerful hardware. We’ve rounded up the best of the best at this size.
Halo: MCC’s live service elements make it better, not worse
Halo: The Master Chief Collection is more popular than ever, but some fans don’t agree with the live service approach 343 Industries has taken with it. Here’s why those elements are, at the end of the day, great for the game and for Halo overall.
Microsoft’s Surface Duo is not ‘failing up’
Microsoft announced this week that it was expanding Surface Duo availability to nine new commercial markets. While Surface Duo is undoubtedly a work in progress, this is not a sign of a disaster. It’s also doesn’t mean that Surface Duo is selling a ton either. Instead, the reason for the expansion is a lot more straightforward.
These are the best PC sticks when you’re on the move
Instant computer — just add a screen. That’s the general idea behind the ultra-portable PC, but it can be hard to know which one you want. Relax, we have you covered!
WMIC : get Bios serial number
If you are looking to find BIOS serial number from CMD, then wmic bios is the command you would need. Below is the exact command you can run on any Windows computer to retrieve serial number.
We can find other bios information also using ‘wmic bios get’ command. In the above command you need to replace ‘serialnumber‘ with the appropriate property of bios. Use the below command to get the list of properties.
Windows xp does not have wmic. is there any other way to get serial number?
Save below as sn.vbs and run it. It will show you the unit s/n.
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\CIMV2”)
Set colItems = objWMIService.ExecQuery( _
“SELECT * FROM Win32_BIOS”,,48)
For Each objItem in colItems
Wscript.Echo “———————————–”
Wscript.Echo “Win32_BIOS instance”
Wscript.Echo “———————————–”
Wscript.Echo “SerialNumber: ” & objItem.SerialNumber
Next
I have a desk top computer 27 in dell and I need my serial number
I have a dell Lap Tap that I purchased from a friend.
I want to know if I could till get services under the serial # that I will enter.
4214182897
veronica, what stops you asking dell?
I have a samsung I wanna get my serial number
WMIC BIOS GET SERIAL NUMBER
I have a HP Envy and need my serial number.
wmic bios get serialnumber
ma computer model is 15-bs003TU
please I need serial number
i have asus windows 7 i need my serial number
TELL MY SERIAL NUMBER PLEASE
i have lenovo windows 8 i need my serial number
I have Lenovo I want my serial number
I could not get the wmic bios get serial number to work
wmic bios get /? ——– I did this, and serial number was on the list as N/A
I want to find serial number of our laptop.
I have DELL I want my serial number
I do not know how to find the serial no. of my hp laptop
want to know the s/n of this laptop
wmic bios get manufacturer
sir I have dell laptop corei7 windo 10 ….. sir I want my seriol no
SERIAL NUMBER FOR HP PAVILION LAPTOP
wmic bios get hard drive
I would like to have product serial number of my Lenovo 320S for activation and use of word documents etc. The S/N number is MP1D1GWA
I have a Hp G6 windown 10 and I need my serial number
Thank you
i cant find serial number I did follow instruction as per request
How to get a serial number of a Windows disk?
I’m trying to get a serial number of a disk, using IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER:
However, GetLastError() returns ERROR_INVALID_FUNCTION.
The disk does exist, and it has a serial number, see this registry entry:
How can I retrieve the serial number from C code without using the registry?
2 Answers 2
we can use IOCTL_STORAGE_QUERY_PROPERTY with StorageDeviceProperty (Indicates that the caller is querying for the device descriptor, STORAGE_DEVICE_DESCRIPTOR )
and use SerialNumberOffset member of STORAGE_DEVICE_DESCRIPTOR
Specifies the byte offset from the beginning of the structure to a NULL-terminated ASCII string that contains the device’s serial number. If the device has no serial number, this member is zero.
code can look like this:
also for open device we can use CreateFileW (L»\\\\.\\PhysicalDrive0″, 0, 0, 0, OPEN_EXISTING, 0, 0); — in place dwDesiredAccess we can use 0 because IOCTL_STORAGE_QUERY_PROPERTY defined as CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS) — so FILE_ANY_ACCESS — accept any file access and FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING have sense only for file system devices (more general which use cache) — for disk devices — this is irrelevant
I have tried different approaches and figured out that sending IOCTL_STORAGE_QUERY_PROPERTY doesn’t work as expected for different USB devices in both User and Kernel mode code. For some USB mass storages it doesn’t return serial number. I’d assume that there are 2 correct ways to do that:
- IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER (a few AV products do that?)
- create and send URB_CONTROL_DESCRIPTOR_REQUEST
Update 1. I saw using IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER in the one file system mini-filter driver that was used like the following:
I haven’t tested this yet in KernelMode code, unfortunately, but trying to make it works in user mode code shows that this IOCTL mostly is not supported by different devices, maybe this IOCTL is reserved for the future as a standard way to get the serial number and will be required by USB standards later?
Also, «wmic diskdrive get name, serialnumber» returns in my case for USB Mass Storage incorrect serial number = «E» the same result as we would use IOCTL_STORAGE_QUERY_PROPERTY. So, the correct way to get the serial number of USB mass storage is creating a USB request block in KernelMode code and using DeviceIoControl to the hub driver in the UserMode code.
USBVIEW (UserMode code) gets serial number by sending IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX ioctl to the HUB driver which returns USB_NODE_CONNECTION_INFORMATION_EX that contains USB_DEVICE_DESCRIPTOR. iSerialNumber member of USB_DEVICE_DESCRIPTOR is used later in the IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION ioctl request to the hub driver which finally gets serial number.
Another approach I see is maybe using some 3-rd party libraries like libusb to simplicate all these actions.
Update 2. I took a look at USBSTOR disassembled code. USBSTOR_DeviceControl routine has the following code for the IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER
So, it passes the IRP down the stack to the usbhub driver as was expected. So maybe this functionlaty is expected to be realized in the usbhub driver sometime ? That would be great as for me.
Getting Windows serial number (was: Getting MachineGuid from Registry)
I am trying to fetch MachineGuid from the registry, to create some level of binding with the OS for my license system. From the documentation I can use
to get it. Also, the docs tell me that I get «default» when the name is not found, or null if the key doesn’t exist. I should get a security exception if I have no access.
The above code gives me «default» , which means the name isn’t found. However, if I look in the registry with RegEdit, it’s there. How do I get the MachineGuid value from an application without administrator privileges?
Update: when using reg.exe I have no problems getting the value.
Update: I updated the title, so people looking for a unique way of determining the Windows install get here as well.
3 Answers 3
As other people have already pointed out, you are not supposed to get that value directly from the registry (which is probably why it doesn’t work reliably among different versions of Windows).
A little searching led me to the Win32_OperatingSystem WMI class. Using this class, you can actually get the Windows serial number. It took me some searching and experimenting to get it right, but this is how to use it in C#.
Make sure you have the System.Management.dll reference in your project:
Using the [] operator, you can get any property in the class.
which is probably why it doesn’t work reliably among different versions of Windows
No, that’s not the reason. This problem is caused by the platform target selection for your EXE project. Project + Properties, Build tab, Platform target combobox. You have it set to x86 instead of AnyCPU. On VS2012, the «Prefer 32-bit» checkbox matters. This setting forces your program to run in 32-bit mode on a 64-bit version of Windows. Which has a number of side effects, the one that matters here is that access to registry keys are redirected. Your program is actually reading the value of HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cryptography\MachineGuid. Which doesn’t exist.
The x86 selection is the default for VS2010 and up, previously AnyCPU was the default. Microsoft prefers x86, Visual Studio works better with 32-bit mode processes. Particularly when debugging, VS is a 32-bit process itself so requires the remote debugger if your program executes in 64-bit mode. Which has a few limitations like not supported mixed-mode debugging. And the Edit + Continue feature only works for 32-bit code. Your program itself however works «better» if you have the setting at AnyCPU, including not getting bitten by the file system and registry redirection appcompat features built into Windows.