开发者

SQL Server 2008 unattached installation setting IACCEPTSQLSERVERLICENSETERMS not recognized

I am trying to install SQL Server 2008 Express but I always get this error:

SQL Server Setup has encountered the following error:

The setting 'IACCEPTSQLSERVERLICENSETERMS' specified is not recognized.

Error code 0x84B40003.

My code is here:

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""")
            wri开发者_如何学运维ter.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


Looking at the documentation page, and this blog posting, I don't see why what you're doing doesn't work, but I can suggest two things to try:

  1. Change the case to be IAcceptSQLServerLicenseTerms instead of all caps. I doubt that matters, but it is a difference between your code and what is on these two pages.
  2. Delete that one parameter from the configuration file and add it to the command line arguments, so that

This line:

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

reads as:

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

instead.


I had this same problem myself recently.

The issue is that the /IAcceptSQLServerLicenseTerms option was added in 2008 R2, and so is not available in SQL Server 2008. I just removed the option, but using R2 instead should fix the problem too.

https://connect.microsoft.com/SQLServer/feedback/details/699602/the-setting-iacceptsqlserverlicenseterms-specified-is-not-recognized

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜