Windows – how to do a mass update of an ODBC system DSN

databaseodbcwindows

What's the best way to do a mass update of an SQL Server ODBC system DSN (change the server name)? Group policy? A Login script? Something else? It's an Active Directory domain (windows 2003) with mostly Windows XP clients, but there are some Windows 2000 and Vista clients. All clients need to be updated. Example(s) please.

Thanks

Best Answer

I don't have any examples, but this should get you started. System DSN data is stored in both the registry and an ini file.

// registry location
HKLM\SOFTWARE\ODBC\ODBC.INI

// filesystem location
%WINDIR%\ODBC.INI

On my Vista x64 machine, the server name value is stored in the registry only and should be easy enough to change with a simple login script. Specifically, the value is stored here:

HKLM\SOFTWARE\ADBC\ODBC.INI\MyDSNname
Server = sqlhost.mydomain.com (REG_SZ)