【问题标题】:Remove all versions of LogMeIn software删除所有版本的 LogMeIn 软件
【发布时间】:2020-02-07 01:36:30
【问题描述】:

我正在创建一个 VBScript 来删除所有找到的 LogMeIn 软件实例。它似乎可以安装,但它正在离开注册表项。如果我从 cmd 提示符手动运行该字符串,它将完全卸载,包括删除注册表项。我需要做些什么才能不仅执行 MSI 卸载,还要清理注册表?谢谢你

On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set WshShell = CreateObject("Wscript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = 
"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
   strDisplayName = WshShell.RegRead ("HKLM\" & strKeyPath & "\" & subkey 
& "\Contact")
   If  InStr(1, strDisplayName, "LogMeIn") > 0 Then
'   msgbox "C:\Windows\system32\msiexec.exe /norestart /X " & SubKey & " 
/qn" ' Just for debugging
   WScript.Sleep 20000
   WshShell.Run "cmd /c C:\Windows\System32\msiexec.exe /X" & SubKey & " 
/qn /L*V msilog.txt", 1, True
   End If
Next

【问题讨论】:

  • 您能否详细说明您“从 cmd 提示符手动运行”的字符串。无论该字符串是什么,您都应该能够使用 VBScript 简单地运行它:Set oShell = CreateObject ("WScript.Shell")oShell.run "cmd.exe your string here"
  • @fkiwergrower 对如下所述的 RelatedProducts 调用有什么好处吗?

标签: vbscript uninstallation windows-installer


【解决方案1】:

有多少实例?他们是否使用相同的升级代码?如果是这样,您可以通过单个升级代码卸载所有实例。这是一个示例:Powershell: Uninstall application by UpgradeCode。

更新:C# / .NET version。

还有Windows Installer PowerShell module from Heath Stewart。

这是一个建议的内联脚本 - 我还没有针对重启场景对其进行测试。只需保持产品打开并卸载,看看它是否会触发重启。通过 cscript.exe 调用以进行静默运行:

Const msiUILevelNone = 2
Const msiInstallStateAbsent = 2

Set installer = CreateObject("WindowsInstaller.Installer")
'installer.UILevel = msiUILevelNone ' Disabled to prevent silent uninstall. Now the UAC prompt will show

' Uninstall Orca, replace upgrade code with yours
Set products = installer.RelatedProducts("{UPGRADE-GUID-GOES-HERE-000000000000}")

For Each product In products
   ' MsgBox "Product Code: " & product ' Show the product code found, if you want

   ' The following call when run silently with admin rights may reboot the system without warning!
   ' This is due to badly authored MSI packages - most packages will not trigger this problem.
   installer.ConfigureProduct product, 0,  msiInstallStateAbsent ' Uninstall product

   ' See text above for info on the newer ConfigureProductEx method.
Next

Set installer = Nothing

MsgBox "Finished" ' Just so we know the script ran if nothing found to uninstall

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-07
    • 2018-12-26
    • 2016-07-24
    相关资源
    最近更新 更多