【发布时间】: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