您现在的位置是:网站首页> 编程资料编程资料
Powershell小技巧之使用WMI查询插上的U盘_PowerShell_
2023-05-26
327人已围观
简介 Powershell小技巧之使用WMI查询插上的U盘_PowerShell_
如果你想知道当前插在你电脑上的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版本
您可能感兴趣的文章:
相关内容
- Powershell小技巧之使用WMI测试服务响应_PowerShell_
- Powershell小技巧之系统运行时间_PowerShell_
- Windows Powershell 执行文件和脚本_PowerShell_
- Windows Powershell 通过函数扩展别名_PowerShell_
- Windows Powershell 别名_PowerShell_
- Powershell小技巧之编辑Hosts文件_PowerShell_
- Powershell小技巧之记录脚本的操作_PowerShell_
- Powershell小技巧之获取MAC地址_PowerShell_
- Windows Powershell Do While 循环_PowerShell_
- Windows Powershell Foreach 循环_PowerShell_
