Skip to content

Instantly share code, notes, and snippets.

@Ozymandias42
Last active August 20, 2019 08:25
Show Gist options
  • Save Ozymandias42/2aa27381f58f00e176ea47a01f19036c to your computer and use it in GitHub Desktop.
Save Ozymandias42/2aa27381f58f00e176ea47a01f19036c to your computer and use it in GitHub Desktop.
search function for windows registry in powershell
function Get-UninstallerFromRegistry {
param( [System.String] $query )
$paths=@(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
)
$paths=$paths| Where-Object {(Test-Path $_) }
if ( $query -eq "" ) {
$items=$paths | Get-ChildItem
}
else {
$items=$paths | Get-ChildItem
Where-Object {
(Get-ItemProperty $_).DisplayName -match $query
}
}
return $items
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment