July PowerShell One-Liner
This month’s PowerShell one-liner queries the WMI Win32_Product class for a specified computer and builds a formatted report of all installed applications sorted by vendor. You’ll be able to tell at a glance what is installed, when it was installed, where it was installed from and the product version. Be warned that querying this WMI class may take several minutes or longer.
This one line expression defaults to the local computer, but you can substitute any computername you want. You can also add support for alternate credentials. I’ve broken the expression into several lines for publication purposes but this is in fact a oneline expression.
This has been tested on both PowerShell v1 and v2.
I probably could have left the InstallDate alone since a value like 20090511 isn’t too hard to figure out, but I took the extra step to parse and reorder so that you get a friendlier value of 05/11/2009. Of course if you have different regional settings you might need to tweak my substring parsing.
The oneliner builds a formatted report, but you could easily modify it to use Select-Object instead so that you could export to a CSV, build an HTML report or whatever you require.
There is a wealth of information in this class. Here are some other ways you might want leverage this class:
Download a script file with these expressions here.