noloman
noloman

Reputation: 11965

Install SQL Server Express 2008 in Silent mode along with a C# application

I need to install SQL Server 2008 Express along with my C# application, but in a silent mode. As I want it to be easy for the user (who is a very basic user), I guess I will need a configuration file in order to specify all the parameters that I want it to be installed with.

Can this configuration file be packaged with Visual Studio 2008 so everything is generated, or should I just create the config file, put it into the CD and when SQL Server is installing, specify the config file to be installed with?

Cheers everybody in advance!

Upvotes: 4

Views: 9218

Answers (3)

Jose Ignacio Montes
Jose Ignacio Montes

Reputation: 21

If you need to install quiet silence from c# the code is this: Care to take away all spaces in the string argumentos, I don´t know why but they go with the string and doesn´t work properly

        String sqlfile = @"\Msi\SQLEXPR_x64_ESN.exe"; 
        //or wathever sql inst file you have
        myProcess.StartInfo.FileName = sqlfile;            
        String argumentos = @"/qs /Action=Install  /Features=SQL,Tools /IACCEPTSQLSERVERLICENSETERMS=""True"" /INSTANCENAME=""SQLExpress_AV"" /SQLSYSADMINACCOUNTS=""Builtin\Administrators"" /SQLSVCACCOUNT=""NT AUTHORITY\SYSTEM"" ";

        //MessageBox.Show(argumentos);
        myProcess.StartInfo.Arguments = argumentos;
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.Start();

Upvotes: 2

Cosmin
Cosmin

Reputation: 21416

It can be done. You need to make your EXE bootstrapper launch the SQL Server prerequisite with a custom command line which contains a configuration file or the appropriate command line parameters for a silent install.

Visual Studio setup projects do not support custom prerequisite creation. However, it can be done by manually generating the required manifests.

You can find the manifests structure here: http://msdn.microsoft.com/en-us/library/ms229223(VS.80).aspx

These manifests can be generated automatically with the Bootstrapper Manifest Generator tool.

After generating the package manifests, you can add all these files (including the package) in a separate folder in the Visual Studio prerequisites folder, for example:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages

You can then select the custom prerequisite in your setup project Properties page.

Upvotes: 3

Nikola Radosavljević
Nikola Radosavljević

Reputation: 6911

I haven't tried this personally but there are short clear instructions here

http://sqlbeyond.blogspot.com/2011/07/sql-server-express-2008-r2-unattended.html

Basically, extract your files to a folder and invoke installation as follows:

SETUP.exe /ACTION=Install /INSTANCENAME=SQLExpress /FEATURES=SQLENGINE /QS /IACCEPTSQLSERVERLICENSETERMS=true /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /BROWSERSVCSTARTUPTYPE=Disabled /ADDCURRENTUSERASSQLADMIN=true /TCPENABLED=1 /HIDECONSOLE

Upvotes: 2

Related Questions