Skip to content

Instantly share code, notes, and snippets.

@akunzai
Last active July 17, 2021 17:47
Show Gist options
  • Save akunzai/79ebac57b80fb6bad85e24dabdd93f54 to your computer and use it in GitHub Desktop.
Save akunzai/79ebac57b80fb6bad85e24dabdd93f54 to your computer and use it in GitHub Desktop.
List Installed Programs on Windows
<#
.SYNOPSIS
List Installed Programs on Windows
.EXAMPLE
. ./Get-InstalledProgram.ps1
Get-InstalledProgram | Export-Csv ~/Desktop/InstalledApps.csv -Encoding UTF8 -NoTypeInformation
.EXAMPLE
. ./Get-InstalledProgram.ps1
Get-InstalledProgram -Detail | Format-List
#>
function Get-InstalledProgram() {
Param (
[Parameter(Mandatory = $False)]
[Switch]
[bool]$Detail
)
$paths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*')
if (Test-Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\' -ErrorAction SilentlyContinue) {
$paths += 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*';
}
if ([System.IntPtr]::Size -eq 8) {
$paths += 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*';
if (Test-Path 'HKCU:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' -ErrorAction SilentlyContinue) {
$paths += 'HKCU:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*';
}
}
$programs = Get-ItemProperty $paths | Where-Object { $null -ne $_.DisplayName };
if ($Detail) {
return $programs;
}
return $programs | Select-Object DisplayName, Publisher, DisplayVersion | Sort-Object -Unique -Property Publisher, DisplayName
}
@akunzai
Copy link
Author

akunzai commented Jul 24, 2020

# Execute the script directly from URL 
iwr -useb https://gist.githubusercontent.com/akunzai/79ebac57b80fb6bad85e24dabdd93f54/raw/Get-InstalledProgram.ps1 | iex; Get-InstalledProgram | Export-Csv ~/Desktop/InstalledApps.csv -Encoding UTF8 -NoTypeInformation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment