Last active
July 17, 2021 17:47
-
-
Save akunzai/79ebac57b80fb6bad85e24dabdd93f54 to your computer and use it in GitHub Desktop.
List Installed Programs on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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 | |
} |
Author
akunzai
commented
Jul 24, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment