Hello Everyone,
I have a VBS script that allows me to do a recursive search through a specific registry key to find a key value in multiple of the key directories. And unfortunately it dosn't want to work properly with vb.net in my visual studio even when i try to make the syntax changes, any help would be awsome.
Note: Help on getting this to show the Binary value aswell would be helpful.
Const numRoot = &H80000002
Const strRoot = "HKEY_LOCAL_MACHINE"
Const myRoot = "SOFTWARE\Microsoft"
Dim strComputer,strKey,objReg,myShell
strComputer = "."
Set myShell=CreateObject("WScript.Shell")
Set objReg=GetObject("winmgmts:{impersonationLevel=imp ersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKey = myRoot
MyEnum strKey, objReg, myShell, strRoot, numRoot
Sub MyEnum(strKey,objReg,myShell, strRoot, numRoot)
Dim subKey,arrsubKeys,arrValues,keyValue,keyValueData
'dim Digits(23)
objReg.EnumValues numRoot, strKey, arrValues
If VarType(arrValues)=8204 Then
For Each keyValue in arrValues
keyValueData="REG_FULL_RESOURCE_DESCRIPTOR"
On Error Resume Next
keyValueData=myShell.RegRead(strRoot & "\" & strKey & "\" & keyValue)
On Error Goto 0
If VarType(keyValueData) = 8204 Then
keyValueData=Join(keyValueData,",")
End If
if keyValue="DigitalProductID" then
WScript.Echo strKey & "\" & keyValue & ":=" & keyValueData '&
end if
Next
End If
objReg.EnumKey numRoot, strKey, arrsubKeys
If VarType(arrsubKeys)=8204 Then
For Each subKey in arrsubKeys
'Wscript.Echo strKey & "\" & subKey
If strKey="" Then
MyEnum subKey , objReg, myShell, strRoot, numRoot
Else
MyEnum strKey & "\" & subKey , objReg, myShell, strRoot, numRoot
End If
Next
End If
End Sub
Thanks in advance.
gcasella
(Note: i already have the proper references for the wmi scripting)