Function EnumerateRegistryKeys(strRegTreeName) 'Use the REGEDIT program because the scripting host can't do it. 'Returns a tab-delimited list of keys. Dim wsh, fs Dim strCommand, strRegText, strLine, strKeys, strFile Const ForReading = 1 Const TemporaryFolder = 2 On Error Resume Next Set fs = CreateObject("Scripting.FileSystemObject") Set wsh = CreateObject("WScript.Shell") 'Delete the temp file if it exists strFile = fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(TemporaryFolder), "~reg.txt")) If fs.FileExists(strFile) Then fs.DeleteFile strFile strCommand = "regedit.exe /e """ & strFilestrFile & """" strCommand = strCommand & " """ & strRegTreeName & """" wsh.Run strCommand, 0, True strRegText = "" strRegText = fs.OpenTextFile(strFile, ForReading, False).ReadAll 'Delete the temp file now that we are done with it. If fs.FileExists(strFile) Then fs.DeleteFile strFile 'Ignore empty results If Instr(strRegText, """=""") = 0 Then EnumerateRegistryKeys = "" Exit Function End If 'Trim away beginning strRegText = Mid(strRegText, InStr(strRegText, "]") + 3) 'Trim away end If InStr(strRegText, "[") <> 0 Then strRegText = Left(strRegText, InStr(strRegText, "[") - 3) End If 'Process all desired lines For Each strLine In Split(strRegText, vbLf) If Ubound(Split(strLine, """")) > 1 Then If strKeys = "" Then strKeys = Split(strLine, """")(1) Else strKeys = strKeys & vbTab & Split(strLine, """")(1) End If End If Next EnumerateRegistryKeys = strKeys End Function