【发布时间】:2014-10-13 23:11:48
【问题描述】:
我正在尝试使用 powershell 将应用程序安装在远程服务器上。这是我正在使用的脚本:
$cred = 获取凭据
$s = New-PSSession -ComputerName $ServerName -Credential $credInvoke-Command -Session $s -ScriptBlock {Start-Process -FilePath "c:\windows\system32\msiexec.exe" -ArgumentList "/i \\computer\e$\installer.msi /qn" -Wait }
删除-PSSession -ComputerName $ServerName
如果我直接在远程计算机上运行以下命令,它会执行得很漂亮:
Start-Process -FilePath "c:\windows\system32\msiexec.exe" -ArgumentList "/i \\computer\e$\installer.msi /qn" -Wait
但是当我作为 Invoke-Command 的一部分远程运行它时,PS 会话打开,脚本运行,msiexec 在远程计算机上启动,然后 PS 会话关闭,但应用程序永远不会安装,msiexec 永远不会关闭。
任何帮助将不胜感激。
谢谢,
扎克
【问题讨论】:
标签: windows powershell powershell-3.0