使用PowerShell命令启动进程安装MSI时,出现退出代码1603错误

问题描述

我们希望使用以下脚本在Windows服务器上安装MSI文件,并能够在Windows服务器上安装MSI文件。以下代码对于某些MSI文件运行正常,但对于其他MSI文件则失败。得到退出代码为1603。如果我们进行全新安装,它可以正常工作,但是在尝试重新安装时,我们收到了退出代码:1603错误。所有服务的所有配置设置都相同。

作为mentioned on the Microsoft web site,我们验证了以下条件,但没有适用于我们的情况。

  • Windows Installer尝试安装PC上已安装的应用程序。

  • 您要安装Windows的文件夹 要加密的安装程序包。

  • 包含您要安装Windows Installer软件包的文件夹的驱动器将作为替代驱动器进行访问。

  • SYSTEM帐户对尝试将Windows Installer程序包安装到的文件夹没有完全控制权限。您会注意到错误消息,因为Windows Installer服务使用SYSTEM帐户来安装软件。

代码:

:outer for($i=1; $i -le $attempts; $i++) {
    $timeout = $null
    $proc = Start-Process -filePath $InstallerPath -ArgumentList $InstallCommand -PassThru
    $proc | Wait-Process -Timeout $SecondsToWait -ea 0 -ev timeout
    If (($timeout) -or ($proc.ExitCode -ne 0)) {
        $proc | kill
        $error = "`tFailed To Run $($ProcessTitle)Operations: Exit-Code = $($proc.ExitCode)"
        If(($i+1) -le $attempts) {
            WriteLog -Message($error) -MainLoggingConfigs $MainLoggingConfigs
            Start-Sleep -s $WaitTimePerAttempt
        }
        Else {
            throw $error
        }
    }
    Else {
        break outer
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)