本文介绍了通过 Powershell 调用命令安装 Msi 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 PowerShell 的 Invoke-Command,但遇到一个错误,我不知道它是什么!

I am trying to use PowerShell's Invoke-Command but I am encountering an error that I have no idea of what it is!

如果能在这方面有所帮助就好了.我相信它一定是非常简单的东西..

Would be great to have some help on this. I am sure that it must be something really simple..

invoke-command  -scriptblock{ $executable = "wmic"; & "$executable product call install true","-computername name" ,'path to the msi' }

谢谢!

推荐答案

您可以尝试使用 msiexec:

You could just try using msiexec:

$scriptblock = {Start-Process msiexec.exe -Argumentlist "/i $PathToMSI","/qn"}
invoke-command  -scriptblock $scriptblock -computername $name

我不确定您是否甚至可以通过 wmi 安装 msi,以前从未见过.除此之外,您稍微混淆了调用命令的语法;)

I´m not sure if you even can install msi´s via wmi, never seen it before. Other than that you mixed up the syntax of your invoke-command a bit ;)

这篇关于通过 Powershell 调用命令安装 Msi 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:27