Here is the code to write a SQL Server DSN from VBA or vbs:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\Software\ODBC\ODBC.INI\DSNName\Database" , "DatabaseName"
WshShell.RegWrite "HKLM\Software\ODBC\ODBC.INI\DSNName\Driver", "C:\Windows\System32\\SQLSRV32.dll"
WshShell.RegWrite "HKLM\Software\ODBC\ODBC.INI\DSNName\LastUser" , "DefaultUserName"
WshShell.RegWrite "HKLM\Software\ODBC\ODBC.INI\DSNName\Server", "S_SQLServerName"
WshShell.RegWrite "HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources\DSNName", "SQL Server"
So this should give you an ideea of where to look in the registry.
mmcdonal
|