Get usb device serial number in Windows [duplicate]
Solution 1:
Use the freeware USBDeview:
USBDeview is a small utility that lists all USB devices that currently connected to your computer, as well as all USB devices that you previously used. For each USB device, exteneded information is displayed: Device name/description, device type, serial number (for mass storage devices), the date/time that device was added, VendorID, ProductID, and more... USBDeview also allows you to uninstall USB devices that you previously used, and disconnect USB devices that are currently connected to your computer. You can also use USBDeview on a remote computer, as long as you login to that computer with admin user.
Solution 2:
On Linux, usbview will do this, just click on the device in the left pane.
Solution 3:
Get USB Serial Numbers on Windows with PowerShell
Here's a PowerShell solution that will give you the serial number of all "USB Mass Storage Devices" mounted on the system which you run it. It uses Get-CIMInstance to query the Win32_PnPSignedDriver class to get the property values with filtering, looping, setting a couple variables, using a method, etc.
Within the PowerShell script below, I left some commented out logic and comments for running with the legacy Get-WMIObject cmdlet for systems with versions below PowerShell 3.0.
PowerShell
$DevId = (((Get-CimInstance -Class win32_PnPSignedDriver) | ?{($_.Description -like '*mass*')}).DeviceID);
$DevSerial = @($DevId | %{$_.Split('\')[2]});
$DevSerial
##### // Everything below is commented out with comments for each section \\ #####
## -- See everything or the selected properties per above
#((Get-CimInstance -Class win32_PnPSignedDriver) | ?{($_.Description -like '*mass*')}) |
#Select Description, DeviceClass, DeviceID, Manufacturer
## -- Correlated legacy PS code older than PowerShell version 3
#$DevId = ((Get-WmiObject Win32_USBControllerDevice | %{[wmi]($_.Dependent)} | ?{($_.Description -like '*mass*')}).DeviceID);
#$DevSerial = @($DevId | %{$_.Split('\')[2]});
#$DevSerial
## -- See everything or selected properties per above legacy PS code
#Get-WmiObject Win32_USBControllerDevice | %{[wmi]($_.Dependent)} | ?{($_.Description -like '*mass*')} |
#Select Description, DeviceID, Manufacturer, Service
Supporting Resources
- Get-CIMInstance
- Win32_PnPSignedDriver class
-
ForEach-Object
Standard Aliases for Foreach-Object: the '
%
' symbol, ForEach -
Where-Object
The '
?
' symbol and Where are both aliases for Where-Object. If you explicitly want to run the Where-Object command, run Where-object or '?
' - Comparison Operators
- Split()
- PowerShell one liner to get USB Flash Drive Serial Number
- Get Information from Windows device manager