2011-05-21 2 views
1

Je suis en train d'installer SQL Server 2008 Express, mais je reçois toujours cette erreur:SQL Server 2008 paramètre d'installation sans attaches IACCEPTSQLSERVERLICENSETERMS non reconnu

installation de SQL Server a rencontré l'erreur suivante:

Le réglage 'IACCEPTSQLSERVERLICENSETERMS' spécifié n'est pas reconnu.

Code d'erreur 0x84B40003.

Mon code est ici:

Public NotInheritable Class MSSQL2008CommandlineInstaller 

    Shared WithEvents process As New Process() 

    Private Sub New() 
    End Sub 
    Const MSSQL_SERVER_VERSION As String = "SQLSERVER2008" 
    Const MSSQL_INSTALLER_APP As String = "C:\Users\Hello\Desktop\SQLEXPR_x86_ENU.exe" 

    Public Shared Function Install(ByVal saPassword As String, ByVal instanceName As String) As Integer 
     Dim configFileName As String = Directory.GetCurrentDirectory() & "\MSSQLInstallationConfig.ini" 

     CreateMsSQLConfigurationFile(configFileName, instanceName) 
     Return StartInstallation(MSSQL_INSTALLER_APP, saPassword, configFileName) 
    End Function 

    Private Shared Function StartInstallation(ByVal installerApplication As String, ByVal saPassword As String, ByVal configFileName As String) As Integer 
     Using process 
      process.StartInfo = New ProcessStartInfo(installerApplication) 
      process.StartInfo.Arguments = "/SAPWD=""" & saPassword & """ /CONFIGURATIONFILE=""" & configFileName & """" 
      process.StartInfo.UseShellExecute = False 
      process.StartInfo.RedirectStandardOutput = True 
      process.StartInfo.RedirectStandardError = True 
      process.StartInfo.CreateNoWindow = True 
      process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden 
      process.Start() 
      process.BeginOutputReadLine() 
      process.BeginErrorReadLine() 
      process.WaitForExit() 
      Dim exitCode As Integer = process.ExitCode 
      process.Close() 
      Return exitCode 
     End Using 
    End Function 

    Public Shared Sub OnOutputDataReceived(ByVal sender As Object, ByVal e As DataReceivedEventArgs) Handles process.OutputDataReceived 
     If Not [String].IsNullOrEmpty(e.Data) Then 
      Console.WriteLine("Output: " & Convert.ToString(e.Data)) 
     End If 
    End Sub 

    Public Shared Sub OnErrorDataReceived(ByVal sender As Object, ByVal e As DataReceivedEventArgs) Handles process.ErrorDataReceived 
     If Not [String].IsNullOrEmpty(e.Data) Then 
      Console.WriteLine("Error: " & Convert.ToString(e.Data)) 
     End If 
    End Sub 

    Private Shared Sub CreateMsSQLConfigurationFile(ByVal fileName As String, ByVal instanceName As String) 
     Using configFile = New FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None) 
      Dim writer As New StreamWriter(configFile) 
      writer.WriteLine("[" & MSSQL_SERVER_VERSION & "]") 
      writer.WriteLine("INSTANCEID=""" & instanceName & """") 
      writer.WriteLine("INSTANCENAME=""" & instanceName & """") 
      writer.WriteLine("ACTION=""Install""") 
      writer.WriteLine("FEATURES=SQLENGINE") 
      writer.WriteLine("HIDECONSOLE=""True""") 
      writer.WriteLine("QUIET=""False""") 
      writer.WriteLine("QUIETSIMPLE=""False""") 
      writer.WriteLine("HELP=""False""") 
      writer.WriteLine("INDICATEPROGRESS=""True""") 
      writer.WriteLine("X86=""False""") 
      writer.WriteLine("IACCEPTSQLSERVERLICENSETERMS=""True""") 
      writer.WriteLine("ROLE=""AllFeatures_WithDefaults""") 
      writer.WriteLine("ENU=""True""") 
      writer.WriteLine("ERRORREPORTING=""False""") 
      writer.WriteLine("SQMREPORTING=""False""") 
      writer.WriteLine("AGTSVCACCOUNT=""NT AUTHORITY\NETWORK SERVICE""") 
      writer.WriteLine("AGTSVCSTARTUPTYPE=""Automatic""") 
      writer.WriteLine("SQLSVCACCOUNT=""NT AUTHORITY\NETWORK SERVICE""") 
      writer.WriteLine("SQLSVCSTARTUPTYPE=""Automatic""") 
      writer.WriteLine("SECURITYMODE=""SQL""") 
      writer.WriteLine("ADDCURRENTUSERASSQLADMIN=""True""") 
      writer.WriteLine("FILESTREAMLEVEL=""0""") 
      writer.WriteLine("ENABLERANU=""True""") 
      writer.WriteLine("SQLCOLLATION=""SQL_Latin1_General_CP1_CI_AS""") 
      writer.WriteLine("TCPENABLED=""1""") 
      writer.WriteLine("NPENABLED=""1""") 
      writer.WriteLine("BROWSERSVCSTARTUPTYPE=""Automatic""") 
      writer.Flush() 
     End Using 
    End Sub 
End Class 
+0

J'ai le même problème avec d'exécuter l'installation de SQL Server de la ligne de commande: SQLEXPR_x86_ENU.exe/qs/IACCEPTSQLSERVERLICENSETERMS/ACTION = "Installer"/FEATURES = "SQL"/INSTANCENAME = "SQLEXPRESS"/BROWSERSVCSTARTUPTYPE = "Automatique"/SQLSVCACCOUNT = "NT AUTHORITY \ NETWORK SERVICE" Il me dit la même chose: Le paramètre 'IACCEPTSQLSERVERLICENSETERMS' spécifié n'est pas reconnu, bien que le paramètre soit parfaitement décrit dans le MSDN !! J'utilise la dernière version de SQL Server SP2 2008 Express. – Alex

Répondre

0

En regardant le documentation page et this blog posting, je ne vois pas pourquoi ce que vous faites ne fonctionne pas, mais je peux suggérer deux choses à essayer:

  1. Remplacez le cas par IAcceptSQLServerLicenseTerms au lieu de tous les majuscules. Je doute que cela compte, mais c'est une différence entre votre code et ce qu'il y a sur ces deux pages.
  2. Supprimer qu'un paramètre à partir du fichier de configuration et l'ajouter aux arguments de ligne de commande, de sorte que

Cette ligne:

process.StartInfo.Arguments = "/SAPWD=""" & saPassword & """ /CONFIGURATIONFILE=""" & configFileName & """" 

se lit comme:

process.StartInfo.Arguments = "/IAcceptSQLServerLicenseTerms /SAPWD=""" & saPassword & """ /CONFIGURATIONFILE=""" & configFileName & """" 

à la place.