PowerShell 技能连载 - 查找已知的 USB 驱动器

您知道吗?Windows 维护着一个关于所有插入过您机器中的 USB 存储设备列表。要导出这个列表十分简单:

$Path = 'HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR\*\*'
Get-ItemProperty -Path $Path |
  Select-Object -Property FriendlyName, CompatibleIDs, Mfg

结果看起来如下:

FriendlyName                                CompatibleIDs                              Mfg                                       
------------                                -------------                              ---                                       
SCANNER USB Device                          {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Android UMS Composite USB Device            {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Android UMS Composite USB Device            {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Generic Flash Disk USB Device               {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Hitachi HTS545050B9A300 USB Device          {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Landi A015 USB Device                       {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Landi A015 USB Device                       {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Landi A015 USB Device                       {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Linux File-CD Gadget USB Device             {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Linux File-CD Gadget USB Device             {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Linux File-CD Gadget USB Device             {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Linux File-CD Gadget USB Device             {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Multiple Card  Reader USB Device            {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
SAMSUNG GT-I9000 USB Device                 {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
SAMSUNG GT-I9000 Card USB Device            {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
SAMSUNG GT-I9000 Card USB Device            {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
Ut165 USB Flash Disk USB Device             {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...
WD Elements 1042 USB Device                 {USBSTOR\Disk, USBSTOR\RAW, GenDisk}       @disk.inf,%genmanufacturer%;(Standard d...

列表越长,说明您的计算机插入过越多种不同的 USB 存储设备。

本文国际来源:Finding Known USB Drives

评论