2016-06-21 8 views
0

Ich habe die automatische Installation von SQL Express 2014 mit C# pro-grammatisch versucht. Hier ist der Code, den ich ausprobiert habe.SQL Express 2014 Silent Installation funktioniert nicht mit C#

string strSQLPath = "C:\\SQLEXPR.exe"; 

string SQLfn = strSQLPath; 

string SQLp = @"/QS SAPWD=""C0mp!ex"" ConfigurationFile=""C:\Configuration.ini"""; 


ProcessStartInfo psiSQL = new ProcessStartInfo(SQLfn, SQLp); 
Process SQLprocess = new Process(); 
try 
{ 
    SQLprocess = System.Diagnostics.Process.Start(psiSQL); 
} 
catch (Exception ex) 
{ 
    MessageBox.Show(ex.Message); 
} 
try 
{ 
    SQLprocess.WaitForExit(); 
} 
catch (Exception ex) 
{ 
    MessageBox.Show(ex.Message); 
} 

Ich folgte der configuration.ini Datei Vorbereitung von unten Link.

SQL Server Express Silent Installation

Ich habe auch versucht das folgende Argument Serie.

//string SQLp = "/qn INSTANCENAME=SQLEXPRESS ADDLOCAL=ALL"; 
//string SQLp = @"/qs Action=Install InstanceName=SQLExpress"; 

//string SQLp = @"/qs Action=Install IAcceptSQLServerLicenseTerms=True Features=SQL,Tools InstanceName=SQLExpress SQLSYSADMINACCOUNTS=""Builtin\Administrators"" SQLSVCACCOUNT=""DomainName\UserName"" SQLSVCPASSWORD=""StrongPassword"""; 

//string SQLp = "/qs Action=Install Hideconsole Features=SQL,Tools InstanceName=SQLEXPRESS SQLSYSADMINACCOUNTS=Administrators SQLSVCACCOUNT=global\admin SQLSVCPASSWORD=password"; 
//string SQLp = "/q ACTION=INSTALL INSTANCENAME=SQLEXPRESS ADDLOCAL=ALL ROLE=AllFeatures_WithDefaults ENU=True QUIET=True INSTALLSHAREDWOWDIR=C:\\Program Files (x86)\\Microsoft SQL Server"; 

Keiner der Befehl funktioniert für mich. SQL Express Edition wird überhaupt nicht installiert.

Es zeigt nun einen Fehler (wegen des QS-Befehls sein kann), aber schließlich nicht, dass ich jede SQL-Komponente sehen bekam installiert (bezogen Bedienfeld)

Bitte legen nahe, das Problem zu beheben.

Hinweis: Ich verwende "Express 64BIT \ SQLEXPR_x64_ENU.exe", die von der Microsoft Download-Seite heruntergeladen wurde.

+0

Sind Sie in der Lage, eine unbeaufsichtigte Installation mit dieser Befehlszeile ausführen? Wenn Sie eine Batch-Datei, die funktioniert, nicht schreiben können, wird das in C# nicht helfen. –

Antwort

0

Der folgende Befehl funktioniert für mich ...

Setup.exe/ACTION = Install/FEATURE = SQL/INSTANCENAME = SQLEXPRESS /SECURITY = SQL/SAPWD = "Password1"/SQLSVCACCOUNT = "NT AUTHORITY \ SYSTEM“/ SQLSYSADMINACCOUNTS = "VORDEFINIERT \ Administratoren" /IACCEPTSQ LSERVERLICENSETERMS/SkipInstallerRunCheck/QS

0
var newPro = Process.Start(sq\SetupfilePath, @"/q /Action=Install /IACCEPTSQLSERVERLICENSETERMS /Hideconsole /Features=SQLEngine /InstanceName=SQLEXPRESS /SQLSYSADMINACCOUNTS=""NT AUTHORITY\SYSTEM"" /SQLSVCACCOUNT=""NT AUTHORITY\SYSTEM"" /BROWSERSVCSTARTUPTYPE=""Automatic"""); 
Verwandte Themen