2016-06-21 5 views
0

J'ai essayé l'installation silencieuse de SQL Express 2014 avec C# pro-grammaticalement. Voici le code que j'ai essayé.SQL Express 2014 installation silencieuse ne fonctionne pas avec 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); 
} 

J'ai suivi la préparation du fichier configuration.ini de lien ci-dessous.

SQL Server Express Silent Installation

J'ai essayé aussi la série argument suivant.

//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"; 

Aucune de la commande fonctionne pour moi. SQL Express Edition n'est pas installé du tout.

Il montre maintenant toute erreur (peut être à cause de commande QS), mais finalement je ne vois pas un composant SQL est bien installé (en référence panneau de commande)

S'il vous plaît suggérer pour résoudre le problème.

Note: J'utilise "express 64BIT \ SQLEXPR_x64_ENU.exe" qui a été téléchargé à partir de la page de téléchargement de Microsoft.

+0

êtes-vous en mesure d'effectuer une installation silencieuse avec cette ligne de commande? Si vous ne pouvez pas écrire un fichier batch qui fonctionne, faire la même chose en C# n'aidera pas. –

Répondre

0

Les travaux de commande suivante pour moi ...

Setup.exe/ACTION = Installer/FEATURES = SQL/INSTANCENAME = SQLEXPRESS /SECURITYMODE = SQL/SAPWD = "Password1"/SQLSVCACCOUNT = "NT AUTHORITY \ SYSTEM »/ SQLSYSADMINACCOUNTS = "BUILTIN \ Administrators" /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""");