Clickonceアプリケーションのアンインストールをコマンドラインから実行する方法

ClickOnceアプリケーションのアンインストールを実行するためのコマンドはこの↓レジストリにある。

Get the uninstall string from the registry. It will be in some location like:

HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\\UninstallString

On Error Resume Next

Set objShell = WScript.CreateObject("WScript.Shell")

''アンインストールするアプリを念のためKILL
objShell.Run "taskkill /f /im <your app process name>*"

'' レジストリから取得したUninstallStringを実行する
objShell.Run "<your app UninstallString>"

''アンインストールのダイアログが表示されたら・・・
Do Until Success = True
    Success = objShell.AppActivate("<アプリケーション名> の保守")
    Wscript.Sleep 200
Loop

''OKを押下しアンインストールを実行する。
objShell.SendKeys "OK"