Powershell小技巧之使用WMI查询插上的U盘
时间:2021-05-02 08:17:36|栏目:|点击: 次
如果你想知道当前插在你电脑上的USB设备,WMI能帮助你:
Get-WmiObject -Class Win32_PnPEntity |
Where-Object { $_.DeviceID -like 'USBSTOR*' }
这将返回所有插上在使用的USBSTOR设备类
如果你使用WMI查询语言(WQL),你甚至可以使用筛选命令:
Get-WmiObject -Query 'Select * From Win32_PnPEntity where DeviceID Like "USBSTOR%"'
本方法适合所有的powershell版本
上一篇:vmt的修改之正则(桂军)
栏 目:
下一篇:docker 容器上编译 go 程序提示找不到文件问题
本文标题:Powershell小技巧之使用WMI查询插上的U盘
本文地址:http://www.codeinn.net/misctech/112854.html






