首页
社区
课程
招聘
[原创]WMI方式查询加密狗或USB PID VID[VBS源码]
发表于: 2014-6-28 11:38 6888

[原创]WMI方式查询加密狗或USB PID VID[VBS源码]

2014-6-28 11:38
6888
strComputer = "." 
Set fso = CreateObject("Scripting.FileSystemObject")
Set dd= fso.CreateTextFile("USB设备列表文件.txt")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
Set colDevices = objWMIService.ExecQuery _ 
("Select * From Win32_USBControllerDevice") 
For Each objDevice in colDevices 
strDeviceName = objDevice.Dependent 
strQuotes = Chr(34) 
strDeviceName = Replace(strDeviceName, strQuotes, "") 
arrDeviceNames = Split(strDeviceName, "=") 
strDeviceName = arrDeviceNames(1) 
Set colUSBDevices = objWMIService.ExecQuery _ 
("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'") 
aa=InStr(strDeviceName,"PID_")
bb=InStr(strDeviceName,"MI_")
cc=Left(strDeviceName,3)
if aa>1 and bb<1 and cc="USB" then
dd.write (strDeviceName&vbCrLf)
else
end if	
Next  
msgbox "查询完毕!",64,"smny" 

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 8
支持
分享
最新回复 (1)
雪    币: 228
活跃值: (104)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
謝謝,先收下後!
2023-4-1 09:42
0
游客
登录 | 注册 方可回帖
返回
//