Last active
August 20, 2019 08:25
-
-
Save Ozymandias42/2aa27381f58f00e176ea47a01f19036c to your computer and use it in GitHub Desktop.
search function for windows registry in powershell
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
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