Saw a question come up on Twitter the other day about finding installed software using PowerShell. I haven’t really needed to pull that rabbit out of my hat in a while. Last time I had really done that it was in VBscript.
Got curious and decided to do a little self re-education. Turns out how you find that information in fact hasn’t changed any since then, and it is just as knarly as it was back then. I suspect that has more to do with the mechanisms within a Windows OS to faciliate installers rather then the technology utilized to extract that particular information.
Ideally, hopefully, all the software (or at lest the software your looking for) was installed with Windows Installer. If that is the case its pretty cut and dry, the Win32_Product WMI class will give you everything you would want to query or act on.
Get-WmiObject -Class Win32_Product
However there still remains an unfortunate number of “I will be different because I can” installers that do things the way they were done in the Windows 95 days. I’m really not sure what that was but their existence only seems to be acknowledged in the registry, down under the usual Microsoft software hive.
Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
This way also gets you everything from above as well, but not as pretty. I also noticed that even this didn’t seem to list all my installed sotware that was displayed for removal under my nice new Windows 7 “Uninstall Software” control panel. What a mess. I’m not even sure at all how Windows finds some of the installed software.
Some is even good quality, regularly updated software. For instance Fiddler doesn’t even show up either way, really? I’m disapointed. I really think Fiddler should do better, the guy even works for Microsoft I believe. I realize that he is free to do whatever he wants with his own creations on his own time but yikes! Follow the lead of Paint.NET, thats the way its done.
So back to finding installed software via PowerShell. Good luck, it appears to be just as painful as it was back in the “old” days. I can even hear some out there thinking, “…well Windows 8 will have single file packages, ‘copy to install’…” Yeah well it will also have Windows Installer, and ungodly backwards installers that haven’t changed since the days of Windows 95. The more things change the more they stay the same.
Joel,
I feel your pain. I’ve had an ongoing love affair with Win32_Product for use in the enterprise because it was just so darn easy to script against with PowerShell. However, that love affair ended a while ago when I discovered the nasty side-effects of querying against it. There is a KB article out there that explains Win32_Product was not optimized for queries resulting in it being slow and CPU intensive. The nastiest part is it causes all applications installed via Windows Installer to perform a sanity check which may result in a reconfigured application. 😦
Have you ever noticed in your Vista+ logs something along the lines of ‘application configuration complete’ every time you query Win32_Product? Bad, baaad Windows… 😦
There really isn’t a good story for dealing with installed apps at this time. Maybe we should pray WinRT and WMI will fix things on Win8.