PS Script to delete Registry Values

I have an issue with a Dell server that was put into production using a factory image. The image appears to have references to the German language pack, and it is causing issues now with updates and adding features. I converted the server to a VHDX and loaded it into hyper-v so I can experiment in a test environment. In my test lab I am able to fix my issues by manually deleting all the registry values in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackageDetect that contain de-DE (package references for the German language). There are hundreds of these, and it takes a long time to do this manually. Is there a way to use PS to go through PackageDetect, find all entries that contain de-DE, and delete those values? I only want to delete value’s not keys. I am guessing that I need to use wildcards. Any pointers would be greatly appreciated, as I am no PS expert!

You can do the following and just remove -WhatIf if you are happy with the results:

 

$RegKeys = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackageDetect'
foreach ($key in $RegKeys) {
    $key.GetValueNames() | Foreach-Object {
        if ($key.GetValue($_) -match 'de-DE') {
            Remove-ItemProperty -Path $key.PSPath -Name $_ -Whatif
        }
    }
}