这个添加了 USB 设备的详细描述 注意要先开启你的 wmi 服务先,可以去别的版块找下 wmi 相关资料
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")
$colDevices = $objWMIService.ExecQuery ("Select * From Win32_USBControllerDevice")
For $objDevice in $colDevices
$strDeviceName = $objDevice.Dependent
$strQuotes = Chr(34)
$strDeviceName = StringReplace($strDeviceName, $strQuotes, "")
$arrDeviceNames = StringSplit($strDeviceName, "=")
$strDeviceName = $arrDeviceNames[2]
$colUSBDevices = $objWMIService.ExecQuery ("Select * From Win32_PnPEntity Where DeviceID = '" & $strDeviceName & "'")
For $objUSBDevice in $colUSBDevices
MsgBox(0,"USB Description",$objUSBDevice.Description)
Next
MsgBox(0,"USB Devices",$strDeviceName)
Next
[ 本帖最后由 renren 于 2008-5-13 20:05 编辑 ] |