PowerTip: Show attached USB Drives with PowerShell

Doctor Scripto

Summary: Use Windows PowerShell to show attached USB drives.

Hey, Scripting Guy! Question Is there an easy way with Windows PowerShell to show all drives that are connected via USB?

Hey, Scripting Guy! AnswerUse Get-WMIObject and query win32_diskdrive:

GET-WMIOBJECT win32_diskdrive | Where { $_.InterfaceType –eq ‘USB’ }


Write this as a query and pass it directly to WMI:

GET-WMIOBJECT –query “SELECT * from win32_diskdrive where InterfaceType = ‘USB’”


Comments are closed. Login to edit/delete your existing comments

Feedback usabilla icon