Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have not yet determined how this occurs but when the following value is blank, all of the existing ODBC configurations become COMPLETELY HIDDEN from the user –- whether using the ODBCAD32.exe tool or when any application prompts the user with a list of pre-configured ODBC connections that truly do exist on their local computer.
1. Open REGEDIT.exe
2. Navigate to HKLM > SOFTWARE > ODBC > ODBC.INI > ODBC Data Sources
3. In the right pane, the entry "(Default)" has a Data value of blank.I am able to manually resolve this issue:
1. Simply right-click the "(Default)" entry and choose delete. After confirming deletion, the system will immediately recreate that REG_SZ entry ... only this time properly setting its value to "(value not set)".
2. Refresh the ODBCAD32.exe window and all of the ODBC configured connections reappear.This occurs on many of our machines running WinXP SP2.
I would like to be able to automate the correcting (change or delete) of this registry value, using WSH scripting, but I do not know how to manipulate that particular entry. Any suggestions?
Thanks!

If you delete the ODBC Data Sources entry from the registry, it will be recreated at the time a child is added to the registry as such:
Option Explicit
Dim WSHShell_hacks
Set WSHShell_hacks = WScript.CreateObject("WScript.Shell")' =================================================================================================
' MASTER ODBC that, when value is not "(value not set)", will hide all of the ODBC from the viewer.
' By deleting it first, it will be auto-created when the first child is written AND will have the
' proper value of "(value not set)" for this master entry.
' =================================================================================================
WSHShell_hacks.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\"' =========================================================================
' Establish ODBC configuration as system DSN for SOME_SQL_DB:
' =========================================================================
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\sysdsn_some_sql_db", "SQL Server", "REG_SZ"WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Database", "some_sql_db", "REG_SZ"
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Description", "some database", "REG_SZ"
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Driver", "C:\Windows\system32\SQLSRV32.dll", "REG_SZ"
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Server", "10.10.5.100\instance_name", "REG_SZ"
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Trusted_Connection", "Yes", "REG_SZ"
Set WSHShell_hacks = Nothing

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |