powershell远程安装msi失败 [英] powershell remote installation of msi fails

查看:143
本文介绍了powershell远程安装msi失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 powershell 在远程服务器上安装 msi 文件.

I'm trying to install a msi file on a remote server using powershell.

服务器 1 是我的构建服务器,服务器 2 是我的应用程序服务器.当构建服务器完成构建时,我想触发一个 powershell 脚本来将最新版本安装到我的应用服务器上.

Server 1 is my build server and server 2 is my application server. When the build server finishes a buil, I want to trigger a powershell script to install the latest version to my application server.

我正在使用以下命令创建会话并执行安装:

I'm using the following command to create a session and execute the installation:

# Create session to Application Server
$Session = New-PSSession -Name <ApplicationServer> -ComputerName <ApplicationServer> -Auth CredSSP -cred OURDOMAIN\MyUser 

# Prepare expression and create script block
$Script = "Invoke-Expression 'msiexec /i <InstallerFile> /qn /L*v C:\Temp\install_fail.log'"
$ScriptBlock = [Scriptblock]::Create($Script)

# Execute in the session
Invoke-Command -ScriptBlock $ScriptBlock -Session $Session

# Clean up the session
Remove-PSSession $Session

日志有如下错误(完整日志见附件install_fail.log)

The log has the following error (see attachment install_fail.log for full log)

MSI (s) (C4:1C) [17:08:05:333]: Note: 1: 1708 
MSI (s) (C4:1C) [17:08:05:333]: Product: WindowsService1 -- Installation failed.

MSI (s) (C4:1C) [17:08:05:335]: Windows Installer installed the product. Product Name: WindowsService1. Product Version: 8.0.0.0. Product Language: 1033. Manufacturer: MyCompany. Installation success or error status: 1603.

当我在 powershell 命令提示符下启动会话并执行安装时,安装成功(请参阅附件 install_success.log 以获取完整日志):ENTER-PSSession -ComputerName调用表达式 'msiexec/i/qn/L*v C:\Temp\install_success.log'退出

When I start a session on the powershell command promt and execute the installation the installation succeeds (see attachment install_success.log for full log): ENTER-PSSession -ComputerName Invoke-Expression 'msiexec /i /qn /L*v C:\Temp\install_success.log' exit

当我在这两种情况下都打印 whoami 时,它返回 OURDOMAIN\MyUser.

When I print whoami in both cases it returns OURDOMAIN\MyUser.

Microsoft 列出了有关 1603 的以下内容:(http://support.microsoft.com/kb/834484)您尝试将 Windows 安装程序包安装到的文件夹已加密.

Microsoft lists the following regarding the 1603: (http://support.microsoft.com/kb/834484) The folder that you are trying to install the Windows Installer package to is encrypted.

文件夹未加密

包含您尝试安装 Windows Installer 程序包的文件夹的驱动器作为替代驱动器被访问.

The drive that contains the folder that you are trying to install the Windows Installer package to is accessed as a substitute drive.

驱动器是服务器硬盘上的一个分区

The drive is a partition on the harddisk of the server

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

The SYSTEM account does not have Full Control permissions on the folder that you are trying to install the Windows Installer package to. You notice the error message because the Windows Installer service uses the SYSTEM account to install software.

SYSTEM 帐户对驱动器和所有文件夹具有完全控制权.

The SYSTEM account has Full Control on the drive and all folders.

请指教...

推荐答案

我最终编写了第二个 PowerShell 脚本,该脚本在服务器上运行,监视特定文件夹中的新 msi 文件.该脚本运行第一个实际执行安装任务的脚本.

I ended up writing a second PowerShell script that runs on the server watching a specific folder for new msi files. The script runs the first script that actually performs the installation tasks.

这篇关于powershell远程安装msi失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆