Skip to content

Instantly share code, notes, and snippets.

@franklinmoy3
Last active December 9, 2023 20:04
Show Gist options
  • Save franklinmoy3/ff66e44c3bb84ce0091fd42098b03aa6 to your computer and use it in GitHub Desktop.
Save franklinmoy3/ff66e44c3bb84ce0091fd42098b03aa6 to your computer and use it in GitHub Desktop.
List Installed Windows Programs
function AnalyzeReg($p, $f) {
Get-ItemProperty $p | ForEach-Object {
if (($_.DisplayName) -or ($_.version)) {
[PSCustomObject]@{
Name = $_.DisplayName;
Bitness = $f;
Version = $_.DisplayVersion;
InstallDate = $_.InstallDate
}
}
}
}
function AnalyzeAppx() {
Get-AppxPackage | ForEach-Object {
if (($_.InstallLocation) -match "C:\\Program Files\\WindowsApps") {
[PSCustomObject]@{
Name = $_.Name;
Bitness = "MSFT Store";
Version = $_.Version;
InstallDate = "MSFT Store"
}
}
}
}
$s = @()
$s += AnalyzeReg 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' "64-bit"
# Note: HKCU holds both 32- and 64-bit MSI's here, so the script can't tell the bitness
$s += AnalyzeReg 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' "Unknown"
$s += AnalyzeReg 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' "32-bit"
$s += AnalyzeAppx
$s | Sort-Object -Property Name | Export-csv .\InstalledApps.csv -NoTypeInformation
Write-Host $s.count "programs detected. Output in $pwd\InstalledApps.csv"
Write-Host "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment