使用PowerShell卸载ClickOnce应用程序?

5

如何使用Windows Powershell卸载ClickOnce客户端应用程序?

尝试使用以下命令:

Get-WmiObject Win32_Product -Filter "name='xxxx'"

但是,使用上述命令时,ClickOnce应用程序不会显示出来。但对于其他应用程序有效。(获取所有内容而不使用筛选器也不包含ClickOnce应用程序。但它在添加/删除程序UI中可见)

请帮忙解决。

提前感谢您的帮助。

2个回答

5
请阅读以下内容:
请点击此链接查看相关的IT技术讨论。
$InstalledApplicationNotMSI = Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall | foreach-object {Get-ItemProperty $_.PsPath}


$UninstallString = $InstalledApplicationNotMSI | ? { $_.displayname -eq "YourAppicationDisplayName" } | select uninstallstring


cmd /c $UninstallString.UninstallString

问题在于它不是静默卸载。 您需要添加 sendkey() TAB + ENTER 代码,使其变为静默卸载。

非常感谢您的回答! :) 我之前确实看到了那个链接,不确定它是否正确回答了我的问题。而且,它相当古老了。让我在这里重新表述我的问题。是否可能使用WMI/Powershell获取对ClickOnce安装应用程序的引用? - BuddhiP
我在阅读了我链接中的旧文章后,按照我的编辑编写了解决方案! :-) - CB.

2
这是一个简单的PowerShell脚本,用于卸载ClickOnce应用程序(其中DisplayName =您的应用程序进程名称),并处理UI:
$InstalledApplicationNotMSI = Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall | foreach-object {Get-ItemProperty $_.PsPath}
$UninstallString = $InstalledApplicationNotMSI | ? { $_.displayname -match "[your app process name]" } | select UninstallString 
$wshell = new-object -com wscript.shell
$selectedUninstallString = $UninstallString.UninstallString
$wshell.run("cmd /c $selectedUninstallString")
Start-Sleep 5
$wshell.sendkeys("`"OK`"~")

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接