Alternatives to Win32_Product

This topic contains 5 replies, has 3 voices, and was last updated by  Lery 4 years, 6 months ago.

  • Author
    Posts
  • #6804

    Lery
    Participant

    I'm curious about what alternatives you use for querying Win32_product via WMI? As per Microsoft this is a bad thing I can ask Google, and I know some alternatives but I'm curious as to what you all do.

    So while Get-WmiObject win32_Product is great, it's triggering MSI Installer for every application.

  • #6813

    Poshoholic
    Participant

    Can you clarify what you mean by "it's triggering MSI installer for every application", and "as per Microsoft this is a bad thing"? I use Win32_Product and haven't run into any issues with MSI installer.

  • #6826

    Lery
    Participant

    Poshoholic,

    You bet. On Windows 7 SP1 open Powershell and run this command: Get-WmiObject win32_Product

    When finished open your Event Viewer, and go to Application. You should see many messages stating:
    Windows Installer reconfigured the product. Product Name: . Product Version: Product Language: . Manufacturer: . Reconfiguration success or error status: 0.

    To quote the article I linked:

    Win32_product Class is not query optimized. Queries such as “select * from Win32_Product where (name like 'Sniffer%')” require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure.

    That would be why it's bad. Initiating a consistency check, verifying, and repairing the install. If this were a server and not a client OS, it could cause big potential problems.

    It has been stated, not by Microsoft, that the message is false positive. It does not actually trigger a repair. But, are you willing to gamble that?

  • #6830

    David Christian
    Participant

    Are you trying to get program information?

    I usually enumerate the registry.

    Take a look at this key (remove the wow for 32-bit machines):
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

    Maybe you could do something like this:

    gp -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | select DisplayName,Publisher,Version,UninstallString
  • #6832

    Poshoholic
    Participant

    Clearly I read your original post too early in the morning, because I had Win32_Process on the brain, not Win32_Product, which totally makes sense now. I'll blame it on the fact that I don't drink coffee or caffeine. 🙂

    I don't know of alternatives for Win32_Product though with perhaps the exception of going into the Registry and getting the information on the installed products directly from there.

  • #6835

    Lery
    Participant

    Yup, so far the registry is my only alternative. Which is fine. Just looking for ideas 🙂

You must be logged in to reply to this topic.