首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >删除LogMeIn软件的所有版本

删除LogMeIn软件的所有版本
EN

Stack Overflow用户
提问于 2019-10-10 00:49:39
回答 1查看 261关注 0票数 0

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

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2019-10-10 03:15:37

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

更新C# / .NET version

还有Windows Installer PowerShell module from Heath Stewart

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

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58308820

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档