我从 Microsoft 下载了 SQL Server 2008 R2 软件,并正在编写静默安装脚本。我收到以下错误(重复粘贴作业并非偶然,它就是这样显示的)
The following error occurred:
Exception has been thrown by the target of an invocation.
Error result: 1152035024
Result facility code: 1194
Result error code: 43216
Please review the summary.txt log for further details
The following error occurred:
Exception has been thrown by the target of an invocation.
Error result: 1152035024
Result facility code: 1194
Result error code: 43216
Please review the summary.txt log for further details
Microsoft (R) SQL Server 2008 R2 Setup 10.50.1600.01
这是详细的 SQL 安装日志中显示的内容。
2011-02-23 09:53:13 Slp: Running Action: ExecuteInitWorkflow
2011-02-23 09:53:13 Slp: Workflow to execute: 'INITIALIZATION'
2011-02-23 09:53:13 Slp: Error: Action "Microsoft.SqlServer.Configuration.BootstrapExtension.ExecuteWorkflowAction" threw an exception during execution.
2011-02-23 09:53:13 Slp: Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
2011-02-23 09:53:13 Slp: Parameter name: InstallMediaPath
希望有人能帮助我解决这个问题。这是我的 PowerShell 代码的简单版本。
$arguments = @()
$arguments += "/q"
$arguments += "/ACTION=Install"
$arguments += "/FEATURES=SQL,Tools"
$arguments += "/INSTANCENAME=MSSQLSERVER"
$arguments += "/SQLSVCACCOUNT=`"$NetBIOSDomainName\$SQLServerServiceAccount`""
$arguments += "/SQLSVCPASSWORD=`"$SQLServerServiceAccountPassword`""
$arguments += "/SQLSYSADMINACCOUNTS=`"$NetBIOSDomainName\$SQLSysAdminAccount`""
$arguments += "/AGTSVCACCOUNT=`"$NetBIOSDomainName\$SQLServerAgentAccount`""
$arguments += "/IACCEPTSQLSERVERLICENSETERMS"
Start-Process "$SQLServerSetupLocation\setup.exe" -Wait -ArgumentList $arguments -RedirectStandardOutput error.txt
答案1
我认为我的问题最终是因为我没有使用 Start-Process cmdlet 的 -WorkingDirectory 参数。setup.exe 文件在安装过程中调用各种进程,我认为它调用的子进程不知道正确的“WorkingDirectory”。有效的代码如下。
Start-Process "$SQLServerSetupLocation\setup.exe" -Wait -WorkingDirectory $SQLServerSetupLocation -ArgumentList $arguments