Enable remote connections to sql express with a script

自闭症网瘾萝莉.ら 提交于 2019-11-30 22:24:05

downloaded sql server express 2008 (SQLEXPR32_x86_ENU.exe) and place it in the root of my c drive. then I install it with the following parameters:

C:\SQLEXPR32_x86_ENU.exe /q /hideconsole /action=Install /features=SQL /instancename=SQLEXPRESS /enableranu=1 /sqlsvcaccount="NT Authority\Network Service" /AddCurrentUserAsSqlAdmin /skiprules=RebootRequiredCheck /TCPENABLED=1

I add /TCPENABLED=1 in order to enable TCP/IP

These might be of some help, I've had it on my todo list for a while for the computers I have to setup for my app to run with Sql Server 2008 Express. It's basically a way to setup a script that the SQL08exp installer will read and automate a lot of the setup according to what you set in the script.

http://digitalformula.net/articles/how-to-perform-an-unattended-installation-of-sql-server-2008-express/

http://blogesh.wordpress.com/2008/09/23/silent-install-of-sql-server-2008/

I suggest you to create modified bootstrapper package to install Sql Server 2005 Express with customzation.

As an alternative, you can also use a custom action in your installer to change the targeted server using SMO.

Something like this:

Server server = new Server( "ServerName\\InstanceName" ); 
server.ConnectionContext.Connect();
server.Settings.LoginMode = ServerLoginMode.Mixed;
server.Settings.Alter();

We use SMO object to create user login and associate user to our created application database.. even run sql script to create database if database is not available..

Refer these links:
Configuring SQL Express During Installation
Configuring SQL Server when included as a requirement

Note: Create your sql server connection string settings in App.config file rather than putting hardcore in code.. this will help you customize application first run customization e.g. database creation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!