在多台服务器上安装Powershell或升级

时间:2018-06-22 05:39:29

标签: powershell

有人可以帮助我使用Powershell脚本在多台服务器上安装或升级Powershell v5,而无需重新启动服务器。

我在脚本中使用了以下命令,并且抛出错误。

Start-Process -Path \\"$computer"\"$path1"” -ArgumentList “/closeprograms”, “/passive”, “update-no”, /norestart” -Wait
Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At C:\Users\Joy\Desktop\Joy\update.ps1:21 char:3
+      Start-Process \\"$computer\$path1"” -ArgumentList “/closeprograms”, “/passive” ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

1 个答案:

答案 0 :(得分:-1)

根据评论,看来您指向的地方不正确

$path1 = C:\Program Files (x86)\McAfee\Win7AndW2K8R2-KB3134760-x64.msu

但是,如果您尝试在不同的服务器上运行,那么除非此文件位于所有服务器的此位置,否则您将不进行更新;如果您的SAN带有可以调用的文件,请指向然后运行。