I am in a situation where I need to Install SQL Server 2008 R2 Express silently. I want to use C# for this but couldn't get a working solution.
Can someone post a working C# code for above scenario?
The Following code worked for mee..
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo(@"c:\temp\SQLEXPR_x86_ENU.exe",
@"/q /ACTION=Install /FEATURES=SQL /INSTANCENAME=SQLSILENT /SQLSVCSTARTUPTYPE=Automatic /SQLSVCACCOUNT=""NT AUTHORITY\NETWORK SERVICE"" /SQLSYSADMINACCOUNTS=""BUILTIN\Administrators"" /AGTSVCACCOUNT=""NT AUTHORITY\Network Service"" /ADDCURRENTUSERASSQLADMIN=true /SECURITYMODE=SQL /SAPWD=""Password@123""");
p.StartInfo.UseShellExecute = false;
p.Start();
p.WaitForExit();
p.Close();
}
For only windows authentication remove /SECURITYMODE=SQL /SAPWD="Password@123"