Doesn’t list all the programs installed, however, if I use the registry I get them all plus a TRUCKLOAD more, not just the ones showing in Control Panel under “Programs and Features”, any clues?
That’s just the way that particular class was written. It’s kind of always been that way. Win32_Product does the same thing - it’s due in part to the fact that different applications register themselves differently, and ones not in the Windows Installer database will usually be missed.
The most reliable method, generally speaking, is to query the registry directly looking for uninstall strings. Most applications will register some kind of uninstall string to allow users to uninstall the software via Control Panel, so you can follow the breadcrumbs from there.
Indeed, using the registry seems the way to go, however, is also annoying since you get a list of software NOT listed in Control Panel (e.g. Windows updates)
Actually that’s a great idea, however, it requires PSRemoting and in my environment the All-knowing-all-wise Security Team frown upon that, don’t ask me why.
Using win32_Product is not recommended as Rob mentioned. I would echo what Joel mentioned , you can browse through registry and is the most successful approach ever for this.I suggest iterating trough both 64bit and 32bit paths.
You can use this script form TechNet script repository.
My script works fine and I’m using the registry, I get all the installed software, my question was only if there was a way to improve the results, meaning, to show only the same software listed in Control Panel, the cmdlet Get-Package can be used but not without having PSRemoting enabled.