Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search registry in Powershell for specific keys and values within those keys

I'm fairly close to a solution, but I just can't get there. What I'm trying to do is search for installed MS Office updates. The best way I've found is to search the HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall key.

What I then want to do is only look at sub-keys like *{90140000-001* (which indicates Office) and the search each found sub-key's DisplayName property for "(KB*" - which will indicate it is an update to Office rather than a component.

What I have so far is this:

$ErrorActionPreference = "SilentlyContinue"
Get-ChildItem "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" -Recurse | Where-Object{$_ -like "*{90140000-001*"} | foreach {
Get-ItemProperty $_.DisplayName}

But it produces blank output.

Is anyone able to please help me finish this off?

like image 671
JAG Avatar asked Nov 27 '25 08:11

JAG


1 Answers

You can use the GetValue method of the current RegistryKey to retrieve the DisplayName:

Get-ChildItem "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" -Recurse | 
    Where Name -like '*{90140000-001*' | foreach {
    $_.GetValue("DisplayName")
}
like image 71
Martin Brandl Avatar answered Nov 29 '25 22:11

Martin Brandl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!