2011-09-14 209 views
4

是否可以使用Windows PowerShell卸载一次客户端应用程序的点击?使用PowerShell卸载ClickOnce应用程序?

GET-WmiObject可以的Win32_Product筛选器 “NAME = 'XXXX'”

当我使用上面,点击一次应用显示不出来。但它适用于其他应用程序。 (在没有过滤器的情况下获取所有内容也不包含点击一次应用程序,但它在添加/删除程序UI中可见)。

请帮忙。

在此先感谢。

回答

3

阅读:评论后

http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/51a44139-2477-4ebb-8567-9189063cf340/

编辑:

$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 

问题是不是静音unistallation。 您必须为sendkey()TAB + ENTER添加代码才能使其静默。

+0

非常感谢您的回答! :)我确实看到之前的链接,不知道它是否正确回答我的问题。另外,它的老式。让我在这里重新提出我的问题。 **是否可以使用WMI/Powershell获得对clickonce已安装应用程序的引用?** – BuddhiP

+0

在我的链接中阅读了旧文章后,我编写了在我的编辑器中写入的解决方案! :-) –

1

下面是一个简单的PowerShell脚本卸载的ClickOnce应用程序(其中显示名称=你的应用程序名称]),并处理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`"~")