[英]Remove all versions of LogMeIn software
I'm creating a VBScript to remove all found instances of LogMeIn Software.我正在创建 VBScript 以删除所有找到的 LogMeIn 软件实例。 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.
如果我从 cmd 提示手动运行字符串,它将完全卸载,包括删除注册表项。 What do I need to do to not just execute the MSI uninstall but to also clean up the registry?
我需要做些什么才能不仅执行 MSI 卸载,还要清理注册表? 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 .
这是一个示例: Powershell:通过 UpgradeCode 卸载应用程序。
UPDATE : C# / .NET version .
更新: C# / .NET 版本。
There is also the Windows Installer PowerShell module from Heath Stewart .
还有来自 Heath Stewart 的 Windows 安装程序 PowerShell 模块。
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:通过
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.