Вот базовый BAT-скрипт, который я использую в качестве отправной точки:
set DBSERVERALIAS=AliasName
set DBSERVER=RealServerName
rem %windir%\system32\cliconfg.exe
reg add HKLM\Software\Microsoft\MSSQLServer\Client\ConnectTo /v %DBSERVERALIAS% /t REG_SZ /d "DBMSSOCN,%DBSERVER%" /f
reg query HKLM\Software\Microsoft\MSSQLServer\Client\ConnectTo
rem 64-bit support for database alias
rem %windir%\SysWOW64\cliconfig.exe
if /i NOT "%PROCESSOR_ARCHITECTURE%" == "X86" (
reg add HKLM\Software\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo /v %DBSERVERALIAS% /t REG_SZ /d "DBMSSOCN,%DBSERVER%" /f
reg query HKLM\Software\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo
)