RE: Deploy ODBC settings
2008/09/10 07:54:13
(permalink)
i usually use a vb scirpt for this.. add all your settings in the VB script so it wont be dependent on the .reg file, but ive done it both ways. Example bellow
ON ERROR RESUME NEXT
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
strValueName = "XXXX" 'Name of DSN name
strValue = "SQL Server"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\XXXX" 'Same as Name of DSN
objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\XXXX" 'Same as Name of DSN
strValueName = "Database"
strValue = "YYYY" 'Default database name
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "Driver"
strValue = "C:\WINDOWS\System32\SQLSRV32.dll"
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
strValueName = "Server"
strValue = "ZZZZ" 'SQL server name
objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
If it Helps, Please rate....