how can i find a reg key recursively with a unique value compared to keys with the same name in a subtree? this is what i have so far, with -notlike being the value of all the keys that dont have a unique value.
this unfortunately doesnt find the reg key for BestViewOption with the unique value. where is my code wrong?
$SearchPath = "HKLM:\SYSTEM\ControlSet001\Control\Video\$VideoID"
$VideoID = Get-ItemPropertyValue -Path "HKLM:SYSTEM\ControlSet001\Enum\$HWID\Device Parameters" -Name VideoID
foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption* | select PSPath } | Sort-Object -Unique | Convert-Path | Where-Object { $_.Data -notlike ([byte[]]@(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00))})) {
$Path
$DisplayPathNumber = Select-String -InputObject $Path -Pattern "(?<=DisplayPath_).*?(?=\\Option)"
$DisplayPathNumber.Matches.Value
$DisplayPathDigit = $DisplayPathNumber.Matches.Value
$DisplayPathDigit
}
}
when a user chooses the HDMI option, it outputs the DisplayPath correctly at the end of the EDID string as its looking for a specific reg key, instead of a specific reg key value like the above code is trying to do. this code below is working.
$SearchPath = "HKLM:\SYSTEM\ControlSet001\Control\Video\$VideoID"
$VideoID = Get-ItemPropertyValue -Path "HKLM:SYSTEM\ControlSet001\Enum\$HWID\Device Parameters" -Name VideoID
foreach ($Path in @(Get-ChildItem $SearchPath -Recurse |% { Get-ItemProperty $_.PSPATH -Name *BestViewOption_Hdmi* | select PSPath } | Sort-Object -Unique | Convert-Path)) {
$Path
$DisplayPathNumber = Select-String -InputObject $Path -Pattern "(?<=DisplayPath_).*?(?=\\Option)"
$DisplayPathNumber.Matches.Value
$DisplayPathDigit = $DisplayPathNumber.Matches.Value
$DisplayPathDigit
}
}
the output should choose the value at the end of this string, which is the DisplayPath being 12 in this instance
EDID_44048_41219_DELL AW2518HF_12
i want the DisplayPath added at the end of the EDID string the same way, except this is for DisplayPort input. there is no unique reg key this time, only a unique reg key value its looking for. how can i get powershell to search recursively through the specified subtree for the instance of a unique BestViewOption reg key specified?
complete script: windows11-scripts/AMDGPU_VividGaming.ps1 at main · shoober420/windows11-scripts · GitHub