- 帖子
- 2874
- 积分
- 7021
- 技术
- 336
- 捐助
- 0
- 注册时间
- 2011-6-2
|
[转载代码] [PowerShell每日技巧]查看已知的USB驱动器(20131205)
Did you know that Windows maintains a list of all USB storage devices ever hooked up to your machine? And it's simple to dump that list:
$Path = 'HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR\*\*'
Get-ItemProperty -Path $Path |
Select-Object -Property FriendlyName, CompatibleIDs, Mfg
The result will look similar to this:
FriendlyName CompatibleIDs Mfg
------------ ------------- ---
HUAWEI Mass Storage USB Device {USBSTOR\CdRom, USBSTOR\RAW} @cdrom.inf,%genmanufacturer%;...
TENDYRON U-DISK USB Device {USBSTOR\CdRom, USBSTOR\RAW} @cdrom.inf,%genmanufacturer%;...
General USB Flash Disk USB Device {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(...
Generic External USB Device {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(...
Ithink B52USB3.0 USB Device {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(...
Kingston DT CNY 13 Snake USB D... {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(...
SanDisk Cruzer Blade USB Device {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(...
Ut165 USB2FlashStorage USB Device {USBSTOR\Disk, USBSTOR\RAW} @disk.inf,%genmanufacturer%;(... |
The longer the list, the more different USB storage device contacts did your computer have.
http://powershell.com/cs/blogs/tips/archive/2013/12/05/finding-known-usb-drives.aspx |
|