VBS加密锁类型查询程序源码
On Error Resume Next
Dim n,h,s
Dim xmlDoc,xmlRoot,xmlNode,lastNode,newNode
Dim doc,docRoot,i,flag
Dim strNodeName,strPath,docPath
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.CreateTextFile("123.txt")
strComputer = "."
'f1.write (strComputer)
If Err.Description = "" Then
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery _
("Select * From Win32_USBControllerDevice")
For Each objDevice in colDevices
n = InStr(1,objDevice.Dependent,"HID\\VID_")
If n>0 Then
h = mid(objDevice.Dependent,n+5,17)
GetkeyInfo(h)
End if
Next
Public Function GetKeyInfo(s)
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = False
xmlDoc.load "data.xml"
If xmlDoc.parseError.errorCode <> 0 Then
Wscript.Echo "错误:" & Chr(13) & xmlDoc.parseError.reason
End If
Set objNodeList = xmlDoc.getElementsByTagName("page")
i = 0
Do While i < objNodeList.length
h = objNodeList(i).selectSingleNode("hid").Text
If h = s Then
s="硬件ID:" & s & Chr(13) & "加密锁类型:" & objNodeList(i).selectSingleNode("type").Text & Chr(13) & "厂商网站:" & objNodeList(i).selectSingleNode("url").Text & Chr(13) & "备份方案:" & objNodeList(i).selectSingleNode("fuck").Text
f1.write (s)
f1.write chr(13) & "#############################################################" & Chr(13)
Exit Do
Else
's = "未知设备:" & s & Chr(13)
'f1.write (s)
i = i + 1
End If
loop
End Function