【问题标题】:Uninstall ClickOnce application with PowerShell?使用 PowerShell 卸载 ClickOnce 应用程序?
【发布时间】:2011-09-14 07:55:43
【问题描述】:

是否可以使用 windows powershell 卸载 click once 客户端应用程序?

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

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

请帮忙。

提前致谢。

【问题讨论】:

    标签: powershell clickonce wmi


    【解决方案1】:

    阅读:

    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
    

    问题在于这不是静默卸载。 您必须为 sendkey() TAB + ENTER 添加代码以使其静默。

    【讨论】:

    • 非常感谢您的回答! :) 我之前确实看过那个链接,不确定它是否正确回答了我的问题。此外,它很旧。让我在这里重新表述我的问题。 是否可以使用 WMI/Powershell 获得对 clickonce 安装应用程序的引用?
    • 在阅读了我链接中的旧文章之后,我构建了在我的编辑中编写的解决方案! :-)
    【解决方案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`"~")
    

    【讨论】:

      猜你喜欢
      • 2017-09-06
      • 2011-06-26
      • 1970-01-01
      • 2010-09-11
      • 2013-08-31
      • 2011-12-17
      • 2011-02-09
      • 2011-03-25
      • 2018-08-11
      相关资源
      最近更新 更多