我想从远程计算机上卸载程序.我知道用于安装的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"
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
谁能告诉我我做错了什么?
这不是我的问题的答案,但它解决了我远程卸载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
| 归档时间: |
|
| 查看次数: |
12833 次 |
| 最近记录: |