如何检测不需要的 Windows\Installer 文件
How to detect unnecessary Windows\Installer file
我进行了很多搜索以找出如何检测不必要的 Windows\Installer 文件!
我相信你们中的很多人以前都遇到过这个问题并以某种方式解决了它。
现在当我看着我的 ---
C:\Windows\Installer
Windows Server 2008 R2 上的目录我可以看到如果总共 126 GB,它已经占用了 42 GB。
现在我想知道我可以只删除那个 Installer
目录中的所有文件,还是我必须检测可以删除哪个文件!
有人知道这个问题的解决方案吗!
无法全部删除。
关于你的问题有一个很好的answer,我在我的实验室测试。对我有用。
注意:如果可以,最好将此文件夹复制到其他盘(如E:)
你如何定义不必要的?
专用系统案例:您想要最小的占用空间并愿意牺牲您不希望使用的功能。
如果一切正常,C:\Windows\Installer中的每个文件都是已安装Windows安装程序包、补丁、转换等的本地缓存。它们是卸载所必需的,auto-repair or on-demand installation to succeed. If you will never need any of those things on these machines (i.e. if you are bringing them up on demand as VMs, and would rebuild them rather than uninstall something), then unless the app itself invokes Windows Installer APIs itself, it may be relatively safe to remove files from C:\Windows\Installer. In addition, you could call the Windows Installer API MsiSourceListEnum 查找用于这些相同目的的其他文件缓存。删除这些文件可能同样安全(或不安全)。
更常见的情况:你不想重建系统
如果您怀疑该文件夹中存在先前升级或卸载留下的未引用文件,您可以尝试使用 Windows Intstaller API 调用来验证这一点。在非常低的级别,您可以调用 MsiEnumProducts (or possibly MsiEnumProductsEx) to find the product codes of all installed products, and MsiGetProductInfo/Ex(szProduct, INSTALLPROPERTY_LOCALPACKAGE, ...) to find its cached .msi file and INSTALLPROPERTY_TRANSFORMS for a list of its transforms. Then MsiEnumPatches/Ex to find all patch codes and MsiGetPatchInfo/Ex(再次使用 INSTALLPROPERTY_LOCALPACKAGE and/or INSTALLPROPERTY_TRANSFORMS)来列出它引用的 .msp 和 .mst 文件。理论上,此处引用的所有文件的完整集合应该与 C:\Windows\Installer 中的完整文件集合相匹配。 (或者还有更多参考资料可以找...)
(在你写任何东西来做这件事之前,考虑一下可能有应用程序可以自动执行此操作,或者更聪明,例如另一个答案中引用的应用程序。)
我进行了很多搜索以找出如何检测不必要的 Windows\Installer 文件!
我相信你们中的很多人以前都遇到过这个问题并以某种方式解决了它。
现在当我看着我的 ---
C:\Windows\Installer
Windows Server 2008 R2 上的目录我可以看到如果总共 126 GB,它已经占用了 42 GB。
现在我想知道我可以只删除那个 Installer
目录中的所有文件,还是我必须检测可以删除哪个文件!
有人知道这个问题的解决方案吗!
无法全部删除。
关于你的问题有一个很好的answer,我在我的实验室测试。对我有用。
注意:如果可以,最好将此文件夹复制到其他盘(如E:)
你如何定义不必要的?
专用系统案例:您想要最小的占用空间并愿意牺牲您不希望使用的功能。
如果一切正常,C:\Windows\Installer中的每个文件都是已安装Windows安装程序包、补丁、转换等的本地缓存。它们是卸载所必需的,auto-repair or on-demand installation to succeed. If you will never need any of those things on these machines (i.e. if you are bringing them up on demand as VMs, and would rebuild them rather than uninstall something), then unless the app itself invokes Windows Installer APIs itself, it may be relatively safe to remove files from C:\Windows\Installer. In addition, you could call the Windows Installer API MsiSourceListEnum 查找用于这些相同目的的其他文件缓存。删除这些文件可能同样安全(或不安全)。
更常见的情况:你不想重建系统
如果您怀疑该文件夹中存在先前升级或卸载留下的未引用文件,您可以尝试使用 Windows Intstaller API 调用来验证这一点。在非常低的级别,您可以调用 MsiEnumProducts (or possibly MsiEnumProductsEx) to find the product codes of all installed products, and MsiGetProductInfo/Ex(szProduct, INSTALLPROPERTY_LOCALPACKAGE, ...) to find its cached .msi file and INSTALLPROPERTY_TRANSFORMS for a list of its transforms. Then MsiEnumPatches/Ex to find all patch codes and MsiGetPatchInfo/Ex(再次使用 INSTALLPROPERTY_LOCALPACKAGE and/or INSTALLPROPERTY_TRANSFORMS)来列出它引用的 .msp 和 .mst 文件。理论上,此处引用的所有文件的完整集合应该与 C:\Windows\Installer 中的完整文件集合相匹配。 (或者还有更多参考资料可以找...)
(在你写任何东西来做这件事之前,考虑一下可能有应用程序可以自动执行此操作,或者更聪明,例如另一个答案中引用的应用程序。)