Here is an example to deleyte the regkey, I have tested in my lab and it works well.
The discovery script:
$RegKey = Test-Path 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\aaa'
if ($RegKey –eq "true")
{Write-Host 'Compliant'}
else
{Write-Host 'Non-Compliant'}
The remediation script:
Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\aaa'
Remember to set the rule as below:
And also check the "remediation" during configuration baseline deployment:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.