Prev: script to read registry subkeys and values
Next: Force command to run for each computer in txt file list of compute
From: 1ncubu5 on 7 Oct 2010 07:21 Hi all, hoping someone can help me here... I have the following two scripts, one reads the values of a key and one reads the subkeys of the key: dim fs, a, x, y Const HKEY_LOCAL_MACHINE = &H80000002 Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("C:\apps\Output.xls", True) strComputer = "." Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Landmark Graphics Corporation\EDT\5000.1" objRegistry.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes For i = 0 to Ubound(arrValueNames) strValueName = arrValueNames(i) objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue x = x & strValueName & " -- " & strValue & vbCrLf Next a.WriteLine(x) strComputer = "." strKeyPath = "SOFTWARE\Landmark Graphics Corporation\EDT\5000.1" Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") EchoSubkeys HKEY_LOCAL_MACHINE, strKeypath Sub EchoSubkeys(HKEY_LOCAL_MACHINE, strKeyPath) objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys If IsArray(arrSubkeys) Then For Each strSubkey In arrSubkeys EchoSubkeys HKLM, strKeyPath & "\" & strSubkey Next End If y = y & strKeyPath & vbCrLf End Sub a.WriteLine(y) a.close Now I would like to be able to output the subkeys of the key, and the subkeys of the subkeys....AND on top of that output the values of all the subkeys, I know it is probably quite easy but just can't get it to work. Any help much appreciated |