// VBA code to paste in an module
1
2 Function ORACLEHOMES(strComputer As String)
3 Const HKEY_LOCAL_MACHINE = &H80000002
4 ORACLEHOMES = ""
5 Dim strKeyPath
6 Dim arrSubKeys
7 Dim oReg
8 Dim strValueName
9 Dim strValue
10 'strComputer = "."
11 Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
12 strKeyPath = "SOFTWARE\ORACLE"
13 oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
14 For Each subkey In arrSubKeys
15 If Left(subkey, 4) = "KEY_" Then
16 strValueName = "ORACLE_HOME"
17 oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, strValueName, strValue
18 If ORACLEHOMES = "" Then
19 ORACLEHOMES = strValue
20 Else
21 ORACLEHOMES = ORACLEHOMES & ";" & strValue
22 End If
23 End If
24 Next
25 End Function