Script to create an ODBC connection

I need to deploy some software via SMS / SCCM, and this software requires that an ODBC connection be created on Windows. The connection information I received requires a username and password. I have a script package to import connection information into the registry, however I do not know how to do this to enter a username and password. I would like the script to put this or put it in some kind of redistributable package.

Thanks, -Mathew

+3
source share
3 answers

You can use the following 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"
+8
source
+4

Here I use a script (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
+3
source

Source: https://habr.com/ru/post/1725312/


All Articles