
Originally Posted by
deadlight
I was able to work around this issue by copying a script to the machine and using the task scheduler to run the script. The task is trigger on application or modification, so if a new odbc connection is added to the preference, i simply add that registry setting to the item level targeting. The script is as follows:
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objShell = CreateObject("WScript.Shell")
Set objReg=GetObject("winmgmts:{impersonationLevel=imp ersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
'Migrate Connections
strKeyPath = "SOFTWARE\ODBC\ODBC.INI"
strKeyPath64 = "HKLM\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\"
MigrateODBC strKeyPath, strKeyPath64
Function MigrateODBC (strKeyPath, strKeyPath64)
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each Subkey in arrSubKeys
strSubKeyPath = strKeyPath & "\" & Subkey
objReg.EnumValues HKEY_LOCAL_MACHINE, strSubKeyPath, arrEntryNames
For Each Entry In arrEntryNames
objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubKeyPath, Entry, strValue
strSubKeyPath64 = Replace (strSubKeyPath, strKeyPath, "")
objShell.RegWrite strKeyPath64 & strSubKeyPath64 & "\" & Entry, strValue, "REG_SZ"
Next
Next
End Function