Get USB Flash Drive Serial Number with PowerShell or Command Line
Easily get the hard coded serial number of a USB flash drive with either the Command prompt in Windows or Powershell. Of the two, Powershell is easier. Below are the instructions. After the instructions there is a bit more information about the different types of serial numbers which can be found associated with a Mass Storage Device (USB flash drive) so be sure to read that part as well, so you get what you want!
In the Windows Search bar, type “powershell” and click Enter
The Powershell utility will run and simply copy and past the following:
Get-WmiObject Win32_DiskDrive | select Model, Name, InterfaceType, SerialNumber
The screen shot below shows the hard drive of the system and a USB flash drive. The command doesn’t clearly label each, so be a little aware of the devices connected compared to what is listed. It is suggested to have only one USB device connected while running Powershell so it is easy to identify the device.
For the Command prompt, go to the USB flash drive itself. In the navigation field at the top (where you can type things) type in cmd. This will open the Command prompt for the USB flash drive itself. From here, copy and paste the following:
wmic path Win32_USBControllerDevice get Dependent | find “USBSTOR”
The screen shot below shows the same result as the Powershell command, BUT the string does have an extra &0 which is not part of the USB flash drive device. So a bit of parsing is required when looking at the number, or parsing of code if you plan to use the Command prompt to find the device serial number programmatically.
From the two above the Powershell solution is a bit more elegant.
However; may we suggest a third option? If you find yourself on this page, there is a high probability there are other features you can benefit from, like making an Image file of your USB stick, or speed benchmarking the performance of your flash drive.
If that is the case, then we recommend our free program, no installation required, standalone exe file that will fetch the serial number of a device as well as provide a tool to create image files or speed test your USB flash drive.
You may download the free program here. Again, no installation required, this is a standalone exe file that can run from your flash drive or hard drive:
FREE DOWNLOAD: Nexcopy USBScrub
With all this said about USB serial numbers, it is important to understand there is a difference between a volume serial number and a logical device serial number. Here is a quick summary between the two.
A volume serial number is the identifying number Windows will assign to a storage device when connected. This is a Windows (the host) number which is assigned to the devicewhen first connected. This volume serial number is also kept in the Windows registry in the event the same device is connected (again) at a later date.
A logical device serial number is the hard coded serial number which follows the device. Meaning, this serial number goes where ever the device goes. This logical serial number cannot be edited, removed, copied or duplicated. There is certainly some value in that!
References:
How To: Get serial number of USB flash drive
How To: Get USB volume serial number and USB device serial number
Fun side note: If you want to edit the serial number of USB flash drives, it can be done with this product.
Tags: command prompt, flash drive, powershell, serial number, usb