Find USB storage devices
Documentation: Microsoft Learn
Query Win32_DiskDrive for USB storage devices. Report model, device ID, size in bytes, and available serial numbers with PowerShell.
The script
Script reader
Inspect before you run
Inspect the script below. It does not run in this browser.
Inspection only — no command has run.
Show reference output
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-CimInstance Win32_DiskDrive | Where-Object InterfaceType -eq USB | Select-Object Model,DeviceID,Size,SerialNumber- Stage 1Get-CimInstance
Positional values or no named parameters - Stage 2Where-Object
-eq - Stage 3Select-Object
Positional values or no named parameters
How it works
Get-CimInstance enumerates Win32_DiskDrive, Where-Object keeps rows whose InterfaceType reads USB, and Select-Object reports the model with the device ID, raw size in bytes, and whatever serial number the firmware exposes.
Adapting it
For devices connected at some point in the past rather than right now, read the USBSTOR keys under HKLM:\SYSTEM\CurrentControlSet\Enum\USB, which retain entries long after the hardware is gone.
If the result is unexpected
A connected USB storage device is absent from the disk report.
The device may not expose InterfaceType as USB, or the storage driver may not have enumerated it yet.
- Inspect the unfiltered disk inventory and compare Model, DeviceID and InterfaceType with the connected device.
Validate the result
The report includes the expected device or documents why its interface classification excludes it.
Keep the check reliable
Document the interface filter and avoid treating an empty report as proof that no removable storage exists.