PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

image rotation

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Forum Posts

03-06-2013 - Extracting Data from one CSV using another
08-12-2014 - Array of different psobjects...
08-27-2014 - Powershell and html

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Finding Attached USB Sticks

All PowerShell Versions

If you'd like to know whether there are currently USB storage devices attached to your computer, WMI can help:

Get-WmiObject -Class Win32_PnPEntity |
  Where-Object { $_.DeviceID -like 'USBSTOR*' } 

This returns all plug and play devices with a device class of "USBSTOR".

If you are willing to use the WMI query language (WQL), you could even do this in a cmdlet filter:

Get-WmiObject -Query 'Select * From Win32_PnPEntity where DeviceID Like "USBSTOR%"'

Twitter This Tip! ReTweet this Tip!

Copyright 2012 PowerShell.com. All rights reserved.