I need to deploy some software through SMS/SCCM and the software requires that an ODBC connection be created in Windows. The connection information I was given requires a user name and password. I have a batch script to import the connection information into the registry, however I don't know how to go about putting the user name and password in. I'd like to script this or put it in some kind of distributable package.
Thanks, -Mathew
You may use the follow script:
%WINDIR%\System32\odbcconf.exe CONFIGDSN "SQL Server" "DSN=ControltubProducao|Description=ControltubProducao|SERVER=10.23.22.18|Trusted_Connection=No|Database=Controltub"
%WINDIR%\SysWOW64\odbcconf.exe CONFIGDSN "SQL Server" "DSN=ControltubProducao|Description=ControltubProducao|SERVER=10.23.22.18|Trusted_Connection=No|Database=Controltub"
Here are examples of how to directly edit the ODBC Registry settings with VBScript, PowerShell, or Perl.
Here's the script I use (jan. 2015). Replace all <> with your names:
@echo off
cls
echo Configure user Data Sources for <ApplicationName>
echo.
set dsn_name=<OdbcLinkName>
set config_dsn=configdsn "SQL Server" "DSN=%dsn_name%|Server=<SqlServerName>|Database=<DatabaseName>|Trusted_Connection=yes"
%windir%\system32\odbcconf %config_dsn%
%windir%\syswow64\odbcconf %config_dsn%
echo Data Source "%dsn_name%" has been configured.
echo.
echo Done.
echo.
pause
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