[windows] WMI "installed" query different from add/remove programs list?

Hope this helps somebody: I've been using the registry-based enumeration in my scripts (as suggested by some of the answers above), but have found that it does not properly enumerate 64-bit software when run on Windows 10 x64 via SCCM (which uses a 32-bit client). Found something like this to be the most straightforward solution in my particular case:

Function Get-Programs($Bits) {
  $Result = @()
  $Output = (reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall /reg:$Bits /s)

  Foreach ($Line in $Output) {
    If ($Line -match '^\s+DisplayName\s+REG_SZ\s+(.+?)$') {
      $Result += New-Object PSObject -Property @{
        DisplayName = $matches[1];
        Bits = "$($Bits)-bit";
      }
    }
  }

  $Result
}

$Software  = Get-Programs 32
$Software += Get-Programs 64

Realize this is a little too Perl-ish in a bad way, but all other alternatives I've seen involved insanity with wrapper scripts and similar clever-clever solutions, and this seems a little more human.

P.S. Trying really hard to refrain from dumping a ton of salt on Microsoft here for making an absolutely trivial thing next to impossible. I.e., enumerating all MS Office versions in use on a network is a task to make a grown man weep.

Examples related to windows

"Permission Denied" trying to run Python on Windows 10 A fatal error occurred while creating a TLS client credential. The internal error state is 10013 How to install OpenJDK 11 on Windows? I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."? git clone: Authentication failed for <URL> How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" XCOPY: Overwrite all without prompt in BATCH Laravel 5 show ErrorException file_put_contents failed to open stream: No such file or directory how to open Jupyter notebook in chrome on windows Tensorflow import error: No module named 'tensorflow'

Examples related to windows-installer

How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning" How can I find the product GUID of an installed MSI setup? Batch script to install MSI How to uninstall with msiexec using product id guid without .msi file present Create an application setup in visual studio 2013 Error 1920 service failed to start. Verify that you have sufficient privileges to start system services How to install .MSI using PowerShell Create MSI or setup project with Visual Studio 2012 AppFabric installation failed because installer MSI returned with error code : 1603 How to create an installer for a .net Windows Service using Visual Studio

Examples related to wmi

How to connect to a remote Windows machine to execute commands using python? How do I get total physical memory size using PowerShell without WMI? Getting the Username from the HKEY_USERS values How to solve '...is a 'type', which is not valid in the given context'? (C#) How to get CPU temperature? WMI "installed" query different from add/remove programs list? Generating a unique machine id