Skip to content

Instantly share code, notes, and snippets.

@Fireforge
Created October 29, 2017 14:01
Show Gist options
  • Save Fireforge/c03818b124ddcda4f5461036909ec8cc to your computer and use it in GitHub Desktop.
Save Fireforge/c03818b124ddcda4f5461036909ec8cc to your computer and use it in GitHub Desktop.
Script to get list of installed programs seen in Control Panel
# Script adapted from the answers in this thread:
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/1fd035f3-a170-4721-a6b5-d4809ca2e39d/getting-list-of-installed-software-that-matches-control-panels-addremove-programs-or-programs?forum=winserverpowershell
# Formatting taken from:
# https://www.howtogeek.com/165293/how-to-get-a-list-of-software-installed-on-your-pc-with-a-single-command/
if (!([Diagnostics.Process]::GetCurrentProcess().Path -match '\\syswow64\\')) {
$unistallPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$unistallWow6432Path = "\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
@(
if (Test-Path "HKLM:$unistallWow6432Path" ) {
Get-ChildItem "HKLM:$unistallWow6432Path"
}
if (Test-Path "HKLM:$unistallPath" ) {
Get-ChildItem "HKLM:$unistallPath"
}
if (Test-Path "HKCU:$unistallWow6432Path") {
Get-ChildItem "HKCU:$unistallWow6432Path"
}
if (Test-Path "HKCU:$unistallPath" ) {
Get-ChildItem "HKCU:$unistallPath"
}
) | ForEach-Object {Get-ItemProperty $_.PSPath } | Where-Object {
$_.DisplayName -and
!$_.SystemComponent -and
!$_.ReleaseType -and
!$_.ParentKeyName -and
($_.UninstallString -or $_.NoRemove) } | Sort-Object Publisher | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate
}
else {
"You are running 32-bit Powershell on 64-bit system. Please run 64-bit Powershell instead." | Write-Host -ForegroundColor Red
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment