PowerShell: List Installed Software on Local Computer in .CSV File

I had to collect the installed software from few computers and i used Belarc Advisor. The fun came when i started to consolidate the data :-)

To make my future life easier, I wrote a PowerShell script that exports a list of the installed programs into .CSV file.

Here it is:


$computerName = Get-WMIObject Win32_ComputerSystem | Select-Object -ExpandProperty name;

$outputFile = "G:\$computerName.csv";
if (Test-Path $outputFile) { Remove-Item $outputFile; }
Add-Content $outputFile "DisplayName¤DisplayVersion¤Publisher¤InstallDate";

$applications = Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*";

foreach ($application in $applications)
    $displayName = $application.DisplayName;
    $displayVersion = $application.DisplayVersion;
    $publisher = $application.Publisher;
    $installDate = $application.InstallDate;

    if ($displayName -ne $null -or $displayVersion -ne $null -or $publisher -ne $null -or $installDate -ne $null)
        Add-Content $outputFile "$displayName¤$displayVersion¤$publisher¤$installDate";

As usual i use ASCII 164 as delimiter.

Keep it simple :-)