gpt4 book ai didi

powershell - 从远程计算机上卸载程序

转载 作者:行者123 更新时间:2023-12-03 00:26:52 25 4
gpt4 key购买 nike

我想从远程计算机上卸载程序。我知道用于安装的MSI的位置,它在远程服务器上,并且可以在下面的$MSIPathFile变量中看到该路径。

当我运行以下脚本时:

$TargetServer = "d-vasbiz01"
$MSIPathFile = "c:\biztalkdeployment\x.Int.MIS-3.0.0.msi"

Invoke-Command -Computer $TargetServer -ScriptBlock {Param($MSIPathFile, $UninstallFlag, $QuietFlag) Start-Process msiexec.exe "/x" $MSIPathFile "/qn"} -ArgumentList "$MSIPathFile", "/x", "/qn"

我收到以下错误:
Invoke-Command -Computer $TargetServer -ScriptBlock {Param($MSIPathFile, $UninstallFlag, $QuietFlag) Start-Process msiexec.exe "/x" $MSIPathFile "/qn"} -ArgumentList "$MSIPathFile", "/x", "/qn"
A positional parameter cannot be found that accepts argument 'c:\biztalkdeployment\x.Int.MIS-3.0.0.msi'.
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

谁能告诉我我在做什么错?

最佳答案

这并不是我的问题的真正答案,但是它解决了远程卸载MSI的问题。我希望这可以对其他人有所帮助,因为我在过去3个小时中尝试了各种技巧!

事实证明,只需一行代码即可实现!

(Get-WmiObject -Class Win32_Product -Filter“Name ='x.Int.MIS for BizTalk 2010 3.0.0'” -ComputerName $ TargetServer).Uninstall()

由以下technet页面提供:http://technet.microsoft.com/en-us/library/dd347651.aspx

关于powershell - 从远程计算机上卸载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11844781/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com