使用 msiexec 卸载程序后,它仍保留在控制面板中(添加/删除程序) [英] After using msiexec to uninstall a program it remains in the control panel (add/remove programs)

查看:36
本文介绍了使用 msiexec 卸载程序后,它仍保留在控制面板中(添加/删除程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来很奇怪.我安装了一个程序(通过 WiX 安装程序),我正在尝试以编程方式(使用 c#)卸载它,所以我使用 msiexec.exe/x{product-code-GUID}.该程序已卸载,但仍显示在控制面板中(添加/删除程序).当我查看注册表时,我看到 HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\ 下的程序,但它不在此产品作为其产品代码的 GUID 下.它在一个看似随机的 GUID 下,甚至在 .msi 中都不存在.任何人都知道为什么以及如何知道 GUID 将是什么,以便我可以以编程方式删除它?

This seems really odd. I have a program installed (via a WiX installer) and I'm trying to uninstall it programatically (using c#) so I use msiexec.exe /x{product-code-GUID}. The program is uninstalled but it still shows in the control panel (add/remove programs). When I look in the registry I see the program under HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\, but it's not under the GUID that this product has as its product code. It's under a seemingly random GUID that doesn't even exist in the .msi. Anyone know why and how I can tell what the GUID will be so that I can programtically remove it?

我想我可以安装我需要卸载的每个版本并检查注册表并使用那里的 GUID.这会起作用,但我想了解为什么 GUID 与产品代码不匹配.

I guess I could install each version that I need to uninstall and inspect the registry and use the GUID that's there. That will work, but I want to understand why the GUID doesn't match the Product Code.

更新 2-15-19 太平洋时间上午 9:21:

UPDATE 2-15-19 9:21am PT:

好的 - 我记录了卸载,这是日志的结尾.它似乎已经成功完成,但它仍然出现在控制面板中:

OK - I logged the uninstall and here's the end of the log. It seems to have completed successfully and yet it still appears in Control Panel:

MSI (s) (10:E4) [09:16:22:812]: Note: 1: 1724 
MSI (s) (10:E4) [09:16:22:812]: Product: Product Name -- Removal completed successfully.

MSI (s) (10:E4) [09:16:22:812]: Windows Installer removed the product. 
Product Name: Product Name. Product Version: 1.21.4. Product Language: 1033. 
Manufacturer: . Removal success or error status: 0.

MSI (s) (10:E4) [09:16:22:870]: Deferring clean up of packages/files, if any 
exist
MSI (s) (10:E4) [09:16:22:870]: MainEngineThread is returning 0
MSI (s) (10:80) [09:16:22:871]: RESTART MANAGER: Session closed.
MSI (s) (10:80) [09:16:22:871]: No System Restore sequence number for this 
installation.
=== Logging stopped: 2/15/2019  9:16:22 ===
MSI (s) (10:80) [09:16:22:892]: User policy value 'DisableRollback' is 0
MSI (s) (10:80) [09:16:22:892]: Machine policy value 'DisableRollback' is 0
MSI (s) (10:80) [09:16:22:892]: Incrementing counter to disable shutdown. 
Counter after increment: 0
MSI (s) (10:80) [09:16:22:892]: Note: 1: 1402 2: 



HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (10:80) [09:16:22:894]: Note: 1: 2265 2:  3: -2147287035 
MSI (s) (10:80) [09:16:22:894]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 
MSI (s) (10:80) [09:16:22:894]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (s) (10:80) [09:16:22:894]: Post-install cleanup: removing installer file 'C:\Windows\Installer\c8de6843.msi'
MSI (s) (10:80) [09:16:22:896]: Post-install cleanup: removing installer file 'C:\Windows\Installer\{2DE751D3-33F4-4C3E-BD12-63E7F7F0A3C9}\icon.ico'
MSI (s) (10:80) [09:16:22:896]: Post-install cleanup: removing installer folder 'C:\Windows\Installer\{2DE751D3-33F4-4C3E-BD12-63E7F7F0A3C9}\' (if empty)
MSI (s) (10:80) [09:16:22:896]: Note: 1: 2318 2:  
MSI (s) (10:80) [09:16:22:897]: Destroying RemoteAPI object.
MSI (s) (10:B4) [09:16:22:897]: Custom Action Manager thread ending.
MSI (c) (78:7C) [09:16:22:898]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (78:7C) [09:16:22:898]: MainEngineThread is returning 0
=== Verbose logging stopped: 2/15/2019  9:16:22 ===

推荐答案

实际解决方案(调试后):

The Actual Solution (after debugging):

运行:C:\ProgramData\Package Cache{Product-GUID}\ProductSetup.exe/uninstall/quiet

<小时>

重复安装:您可能有重复安装.除非您在卸载过程中不小心让添加/删除程序"小程序保持打开状态,在这种情况下,您应该关闭并重新打开它以验证该条目是否仍然存在.


Duplicate Installation: You probably have a duplicate installation. Unless you accidentally left the Add / Remove Programs applet open during uninstall in which case you should close and reopen it to verify that the entry is still present.

噪音":您也可能会因为存在太多软件包而无法看到您的 setup.exe 已作为两个单独的 MSI 安装文件.为防止出现这种情况,请在干净的虚拟机上进行测试并检查 Add/删除其他相关条目的程序列表.

"Noise": You could also have an issue with too many packages present to see that your setup.exe has installed as two separate MSI files. To prevent this, test on a clean virtual and check the Add / Remove Programs list well for other, related entries.

产品代码:您可以使用此处描述的方法之一找到所有已安装产品的产品代码和产品名称:如何找到已安装的 MSI 设置的产品 G​​UID? 也许试试 PowerShell one-liner 或 VBScript.

Product Code: You can find the product codes and product names for all products installed by using one of the methods described here: How can I find the product GUID of an installed MSI setup? Maybe try the PowerShell one-liner, or the VBScript.

回滚:请注意,如果在卸载期间自定义操作失败,MSI 可以回滚其卸载.这意味着回滚成为重新安装或至少恢复的文件卸载删除.因此,在这种情况下,卸载看起来像运行,但由于自定义操作失败,产品已恢复.所以卸载永远不会提交".

Rollback: Note that an MSI can rollback its uninstall if a custom action fails during uninstall. This means that the rollback becomes a re-install or at least a recovery of the files that the uninstall removed. So in this scenario it looks like the uninstall ran, but the product was recovered due to a failing custom action. So the uninstall never "committed".

卸载:这里有几种卸载 MSI 软件包的方法:不使用 msiexec 从命令行卸载 MSI 文件.当您卸载所有条目后,我希望 ARP 条目消失.这是你自己的包裹吗?在这种情况下,重复安装非常常见,因为这是快速测试周期的副产品.

Uninstall: And here are several ways to uninstall MSI packages: Uninstalling an MSI file from the command line without using msiexec. When you have uninstalled all entries I would expect the ARP entry to be gone. Is this your own package? Duplicate installations are very common in such cases as a by-product of rapid test cycles.

打包的 GUID:您在注册表中找到的 GUID 通常是打包的,或者换句话说,其格式与您的 MSI 中的格式不同.

Packed GUIDs: The GUIDs you find in the registry are generally packed, or in other words not formatted the same way as in your MSI.

示例 GUID 转换:

Sample GUID Conversion:

HKEY_CLASSES_ROOT\Installer\Products

Packed GUID: 0076C0A639AEC2738817CDFC311D064A
Normal GUID: {6A0C6700-EA93-372C-8871-DCCF13D160A4}

以下是更多详细信息:

后一个链接有一个 VBScript 可以将打包的 GUID 转换为普通的 GUID.

The latter link has a VBScript to convert Packed GUIDs to normal GUIDs.

LocalPackage:安装 MSI 时,所有系统上都会缓存一个本地包.它将位于 %SystemRoot%\Installer.您可以使用它来定位文件,然后您可以在 Windows 资源管理器中右键单击它并选择卸载".

LocalPackage: There is a local package cached on all systems when an MSI is installed. It will be located in %SystemRoot%\Installer. You can use this to locate the file, and you can then right click it in Windows Explorer and select "Uninstall".

这里的想法不是将此作为您的主要方法,而是确定是否存在您还需要卸载的隐藏 MSI摆脱 ARP 的一切.

The idea here is not to use this as your main approach, but to determine if there is a hidden MSI that you also need to uninstall to get rid of everything from ARP.

这是一个显示LocalPackage路径的VBScript(在桌面上创建VB脚本文件,保存并双击.查找输出msiinfo.csv - 双击并导入到 Excel 或等效文件 - 或记事本):

Here is a VBScript to show the LocalPackage path (create VB script file on desktop, save and double click. Look for output msiinfo.csv - double click and import to Excel or equivalent - or notepad):

' Retrieve all ProductCodes (with ProductName and ProductVersion)
Set fso = CreateObject("Scripting.FileSystemObject")
Set output = fso.CreateTextFile("msiinfo.csv", True, True)
Set installer = CreateObject("WindowsInstaller.Installer")

output.writeline ("Product Code,Product Name,Product Version,Local Package")

On Error Resume Next ' we ignore all errors

For Each product In installer.ProductsEx("", "", 7)
   productcode = product.ProductCode
   name = product.InstallProperty("ProductName")
   version=product.InstallProperty("VersionString")

   local=product.InstallProperty("LocalPackage")

   output.writeline (productcode & ", " & name & ", " & version & ", " & local)
Next

output.Close

<小时>

类似的答案:

这篇关于使用 msiexec 卸载程序后,它仍保留在控制面板中(添加/删除程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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