scipag / HardeningKitty

HardeningKitty - Checks and hardens your Windows configuration
MIT License
1.27k stars 148 forks source link

Update MpPreference error trigger #7

Closed gderybel closed 2 years ago

gderybel commented 2 years ago

I figured out that this error were caused by a misconfiguration in the powershell script. Those policies use the method “MpPreference”.

For the policy 1802, $ResultMethodArgument is equal to : MAPSReporting, and $ResultRecommendedValue is equal to : 2. $ResultCommand is finally equal to : Set-MpPreference -MAPSReporting 2 And $Result (The command executed) is equal to : Invoke-Expression “Set-MpPreference -MAPSReporting 2”

When I try this command on my computer, no error occurres, and the last exit code is ‘0’. In the code, it prompt an error if the $LastExistCode is something else than 1. So I modified the script by : if($LastExitCode -eq 0) …, and I have no error remaining and the value is applied correctly. Proof of concept - 1800 policies.docx

0x6d69636b commented 2 years ago

Thank you for closing and posting it in the dev repo :)