Why is enumerating installed MSI packages so slow?

后端 未结 5 1438
粉色の甜心
粉色の甜心 2021-01-20 18:31

This is a follow up from this question.

I\'m using this slightly modified script to enumerate all installed MSI packages:

strComputer = \".\"

Set ob         


        
相关标签:
5条回答
  • 2021-01-20 18:54

    I suspected a network issue and Wireshark proved me right.

    It seems that Windows Installer happily attempts to reopen all the original .msi files, including those who lived on network shares.

    0 讨论(0)
  • 2021-01-20 18:58

    This works for me and avoids the slowness of the WMI approach:

    Dim installer
    Set installer = CreateObject("WindowsInstaller.Installer")
    Dim productCode, productName
    For Each productCode In installer.Products
        productName = installer.ProductInfo(productCode, "ProductName")
        WScript.Echo productCode & " , " & productName
    Next
    

    Find out more about the Installer object from http://msdn.microsoft.com/en-us/library/windows/desktop/aa369432(v=vs.85).aspx

    0 讨论(0)
  • 2021-01-20 19:00

    Extreme slowness is a known/common problem for enumerating Win32_Products

    If you need an alternate solution, consider building your own list of products using the 'Uninstall' registry entries (as suggested in one of the answers to the original question you referred to).

    Some general references for enumerating Uninstall:

    • TechNet VBScript example: List Installed Software
    • Microsoft KB: How to enumerate the software products that can be uninstalled on a computer

    And to do it remotely, use the WMI registry class, StdRegProv. TechNet even conveniently provides a simple example of using StdRegProv to do the very thing you want: How do I list all the installed applications on a given machine

    0 讨论(0)
  • 2021-01-20 19:17

    When you are using the api functions which are declared in msi.h you are at light speed. i'm using the api for my software software-uptodate and enumerating hundreds of packets takes a second at all.

    0 讨论(0)
  • 2021-01-20 19:19

    Win32_Product WMI class is so slow because it is doing a Consistency Check - processing every package using Msiexec.exe - everytime you use it.

    Check out the issues and vbscript code to do it using a better method at this page: http://csi-windows.com/toolkit/288-win32product-wmi-class-replacement

    0 讨论(0)
提交回复
热议问题