Alternatives to Win32_Product

Welcome Forums General PowerShell Q&A Alternatives to Win32_Product

Viewing 5 reply threads
  • Author
    Posts
    • #6804
      Participant
      Topics: 25
      Replies: 56
      Points: 2
      Rank: Member

      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
      Participant
      Topics: 0
      Replies: 132
      Points: 1
      Rank: Member

      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
      Participant
      Topics: 25
      Replies: 56
      Points: 2
      Rank: Member

      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
      Participant
      Topics: 0
      Replies: 9
      Points: 0
      Rank: Member

      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:

      <pre class=”lang:ps decode:true ” >gp -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | select DisplayName,Publisher,Version,UninstallString

    • #6832
      Participant
      Topics: 0
      Replies: 132
      Points: 1
      Rank: Member

      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
      Participant
      Topics: 25
      Replies: 56
      Points: 2
      Rank: Member

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

Viewing 5 reply threads
  • The topic ‘Alternatives to Win32_Product’ is closed to new replies.