// VBA code to paste in an module
Function ORACLEHOMES(strComputer As String)
Const HKEY_LOCAL_MACHINE = &H80000002
ORACLEHOMES = ""
Dim strKeyPath
Dim arrSubKeys
Dim oReg
Dim strValueName
Dim strValue
'strComputer = "."
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\ORACLE"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
If Left(subkey, 4) = "KEY_" Then
strValueName = "ORACLE_HOME"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, strValueName, strValue
If ORACLEHOMES = "" Then
ORACLEHOMES = strValue
Else
ORACLEHOMES = ORACLEHOMES & ";" & strValue
End If
End If
Next
End Function