saltstack/salt — pull request #13445 by ryepup (2014-06-13 17:10:41+00:00)
Title: win_pkg: `_get_msi_software` uses COM instead of WMI

WMI queries against `Win32_product` have a nasty side effect of
triggering a "repair" operation on all installed software (see
[KB974524][]), which can kill the `TrustedInstaller` service.

Workaround is to use the `WindowsInstaller.Installer` COM object, and
it's [ProductsEx][] property. Unfortunately,
`WindowsInstaller.Installer.ProductsEx` is a "get property" that takes
3 arguments, and [I can't figure out how to call that from
python][SO23497599].

This Runs some powershell (via `cmd.run_all`) to get the name/version
from COM, then parse the results in python to build the dictionary.

Tested by deploying this function as a custom module to a variety of
windows servers and running it, covering:

* no powershell
* powershell v1
* powershell v2

refs #12550

[KB974524]: http://support.microsoft.com/kb/974524
[ProductsEx]: http://msdn.microsoft.com/en-us/library/aa369461%28v=vs.85%29.aspx
[SO23497599]: http://stackoverflow.com/questions/23497599/com-get-property-with-multiple-arguments