Is there a way to export all the ODBC System DSNs from a windows 2003 machine?
INI\ODBC DATA SOURCES, and then returns the names and values of the all the registry entries found there. Each entry will consist of a name (representing the DSN name) and a value (representing the DSN driver).
System DSN information is stored under the HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
registry key. You could export that key to a .reg file and import on another machine.
UPDATE:
You can also do it programmatically. Here are a few examples:
http://www.codeproject.com/KB/database/DSNAdmin.aspx
http://support.microsoft.com/kb/110507
http://blogs.technet.com/b/heyscriptingguy/archive/2004/11/10/can-i-create-and-delete-a-dsn-using-a-script.aspx
I have just done this myself with a very simple bat script for 32bit ODBC sources
regedit /e c:\backup\odbc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI"
and for the 64bit sources or if you are on a 32bit operating system:
regedit /e c:\backup\odbc.reg "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI"
This backs up all of the DSN's however you could then specify the DNS you want.
System DSN's are stored in windows registry under HKLM\Software\ODBC\ODBC.INI
node
So if you export this node to a *.reg file and run this reg file on a target machine, it should work.
The only thing, this reg file will contain some file paths which maybe computer specific, eg
c:\WINNT\System32\bla-bla-bla.dll
includes WINNT folder which on target machine may be called like WINDOWS
. So you will need to spend a bit time to make sure all paths in *.reg file are correct for target machine where you would finally import.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With