Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Defender features errors in Windows #104
- Refactor to use `Set-MpPreference` in a function instead. - Better support for both Windows and Windows 11 with platform-specific logic, due to poor `Remove-MpPreference` used in Windows 10: * Use `Remove-MpPreference` on Windows 11, but switch to `Set-MpPreference` for some edge cases using a flag. * Use `Set-MpPreference` on Windows 10 by default, and use `Remove-MpPreference` for only small amount of cases where it is supported. - Set default value instead of `Remove-MpPreference` on Windows 10 when it does not work as expected. - Improve error messages when: * Command name (cmdlet) is not supported * Command parameter is not support * Failing due to Defender service not working * Argument is not supported (e.g. for 'Broad') - Skip if a parameter or argument is not supported instead of failing. - Set OS defaults when using `Set-MpPreference` when `Remove-MpPreference` does not set the OS defaults. - Skip setting the setting if it already is as desired. - Remove redundant scripts in "Disable remediation actions" setting `LowThreatDefaultAction`, `ModerateThreatDefaultAction`, `HighThreatDefaultAction` and `SevereThreatDefaultAction`. As they are all controlled by and limited to value of `UnknownThreatDefaultAction`. - Fix registry policies not matching cmdlet behavior: > CheckForSignaturesBeforeRunningScan > SignatureUpdateCatchupInterval - Fix reverting registry policies (`reg delete` command and error output): > Disable Malicious Software Reporting tool diagnostic data > Turn off block at first sight - Fix DisableCatchupQuickScan MpPreference command being in wrong category by moving it to its right category and adding its correct equivalent.
- Loading branch information