Option Explicit

Const HKEY_CLASSES_ROOT   = &H80000000
Const HKEY_CURRENT_USER   = &H80000001
Const HKEY_LOCAL_MACHINE  = &H80000002
Const HKEY_USERS          = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005 

Dim oReg : Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

RecurseRegistryKey HKEY_CURRENT_USER, "Control Panel"

Sub RecurseRegistryKey(ByVal sHive, ByVal sKey)
	Dim aSubKeys, sSubKey, iRC, aValueNames, aValueTypes, iI, sType
	'On Error Resume Next
	iRC = oReg.EnumValues(sHive, sKey, aValueNames, aValueTypes)
	If iRC = 0 And IsArray(aValueNames) Then
   		For iI = LBound(aValueNames) To UBound(aValueNames)
    		 Select Case  aValueTypes(iI) 
    		 	Case 1
    		 		sType = "REG_SZ"
    		 	Case 2
    		 		sType = "REG_EXPAND_SZ"
    		 	Case 3
    		 		sType = "REG_BINARY"
    		 	Case 4
    		 		sType = "REG_DWORD"
    		 	Case 7
    		 		sType = "REG_MULTI_SZ"
    		 	Case Else
    		 		sType = "Unknown"
    		 End Select
    		 WScript.Echo sKey & "\" & aValueNames(iI) & " " & sType
    	Next
  	End If
	iRC = oReg.EnumKey(sHive, sKey, aSubKeys)
	If iRC = 0 And IsArray(aSubKeys) Then
		For Each sSubKey In aSubKeys
			If Err.Number <> 0 Then
				Err.Clear
				Exit Sub
			End If
			RecurseRegistryKey sHive, sKey & "\" & sSubKey
		Next
	End If
End Sub

