The code below shows an easy way to gather software information from your machine.
function Get-Soft {
<# gcim win32_product
.SYNOPSIS
Lists software on local or remote machines.
.DESCRIPTION
Lists software on local or remote machines.
.Example
PS C:\> Get-Soft | ft
DisplayName DisplayVersion Publisher
----------- -------------- ---------
FireStorm version V2.0.0.016 V2.0.0.016
OpenAL
Adobe Common File Installer 1.00.0000 Adobe System Incorporated
Adobe Bridge 1.0 001.000.000 Adobe Systems
Adobe Help Center 1.0 001.000.000 Adobe Systems
Adobe Stock Photos 1.0 001.000.000 Adobe Systems
#>
[CmdletBinding()]
param(
[Switch]$NonMicrosoftOnly,
[String]$Publisher,
[String]$Name
)
$soft1 = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* -ErrorAction SilentlyContinue | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation, UninstallString, InstallSource
$soft2 = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* -ErrorAction SilentlyContinue | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, InstallLocation, UninstallString, InstallSource
$soft = $soft1 + $soft2 | ?{$_.DisplayName -notlike $null -and $_.UninstallString -notlike $null}
IF($NonMicrosoftOnly){ $out = $soft | Where-Object{ $_.Publisher -notmatch 'Microsoft'} }
IF($Publisher){ $out = $soft | Where-Object{ $_.Publisher -match $Publisher} }
IF($Name){ $out = $soft | Where-Object{ $_.DisplayName -match $Name} }
IF($out){$out | Sort-object DisplayName}ELSE{$soft | Sort-object DisplayName }
}