删除所有版本的 LogMeIn 软件 [英] Remove all versions of LogMeIn software

查看:40
本文介绍了删除所有版本的 LogMeIn 软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

On Error Resume Next常量 HKEY_LOCAL_MACHINE = &H80000002strComputer = "."Set WshShell = CreateObject("Wscript.Shell")Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_strComputer &"\root\default:StdRegProv")strKeyPath =软件\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"oReg.EnumKey HKEY_LOCAL_MACHINE、strKeyPath、arrSubKeys对于 arrSubKeys 中的每个子键strDisplayName = WshShell.RegRead ("HKLM\" & strKeyPath & "\" & subkey&\接触")如果 InStr(1, strDisplayName, "LogMeIn") >0 那么' msgbox "C:\Windows\system32\msiexec.exe/norestart/X " &子密钥"/qn" ' 仅用于调试WScript.Sleep 20000WshShell.Run "cmd/c C:\Windows\System32\msiexec.exe/X" &子密钥"/qn/L*V msilog.txt", 1, True万一下一个

解决方案

有多少个实例?他们是否使用相同的升级代码?如果是这样,您可以通过单个升级代码卸载所有实例.下面是一个示例:Powershell:通过升级代码卸载应用程序.><块引用>

更新:C#/.NET 版本.

还有 Heath Stewart 的 Windows Installer PowerShell 模块.

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

const msiUILevelNone = 2常量 msiInstallStateAbsent = 2Set installer = CreateObject("WindowsInstaller.Installer")'installer.UILevel = msiUILevelNone ' 禁用以防止静默卸载.现在 UAC 提示将显示' 卸载 Orca,用你的替换升级代码设置产品 = installer.RelatedProducts("{UPGRADE-GUID-GOES-HERE-000000000000}")对于每个产品 在产品中' MsgBox "产品代码:"&product ' 如果需要,显示找到的产品代码' 以管理员权限静默运行以下调用可能会在没有警告的情况下重新启动系统!' 这是由于 MSI 包编写不当造成的 - 大多数包不会触发此问题.installer.ConfigureProduct product, 0, msiInstallStateAbsent ' 卸载产品' 有关较新的 ConfigureProductEx 方法的信息,请参阅上面的文本.下一个设置安装程序 = 无MsgBox "已完成";' 只是为了让我们知道脚本在没有找到卸载的情况下运行

I'm creating a VBScript to remove all found instances of LogMeIn Software. It seems to work installing but it is leaving the registry key. If I run the string manually from the cmd prompt it completely uninstalls, including removing the registry key. What do I need to do to not just execute the MSI uninstall but to also clean up the registry? Thank You

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

解决方案

How many instances? Are they using the same upgrade code? You can uninstall all instances by the single upgrade code if so. Here is an example: Powershell: Uninstall application by UpgradeCode.

UPDATE: C# / .NET version.

There is also the Windows Installer PowerShell module from Heath Stewart.

Here is a proposed script inlined - I haven't tested it for reboot scenarios. Just leave the product open and uninstall and see if it triggers a reboot. Invoke via cscript.exe for silent running:

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

这篇关于删除所有版本的 LogMeIn 软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆