Reputation: 1970
We have many end users having DSN on their machine to connect to our SQL Server through Excel.
Now we have migrated our SQL Server and DSN needs to be edited to below value (From PrevSQLServer to NewSQLServer)
This change needs to be done on many End users machine so we thought we will make a kind of .exe file which we will just ask end user to double click and DSN will get edited.
We thought about .Net (as Windows machine by default have .net framework) to implement above .exe, on Google I realize that this needs to be done by editing registry so went in regedit but there I just do not see SQL Server name (attribute to be edited)
Where I can find SQL Server name in regedit which I can change programmatically? If yes how?
I even read about some ODBC file that can be edited to do this (instead of messing up with regedit)
I found a file ODBC.INI which had entry like
MIX_SQL_PROD=SQL Server (32 bit)
But there is no SQL Server name in that file.
How can I do this work of editing DSN? On Internet I found some code in power shell but not sure about using it as I do not have any expertise with Power shell and not sure PowerShell run time is available on windows machine by default
Upvotes: 1
Views: 639
Reputation: 32737
Two things:
Upvotes: 1
Reputation: 10098
User DSNs are listed in registry under this key:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources
Detail data about a specific DSN are kept here:
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\<DSN name>
You can easily export the info into a reg file and simply import it into users registry.
Upvotes: 1