I was trying to add Microsoft Defender exceptions via PowerShell to a clients server (Windows Server 2016 if that matters) the other day and it was always failing – the error was:
PS> Add-MpPreference -ExclusionExtension .config
Add-MpPreference : Failed to modify preferences.
At line:1 char:1
+ Add-MpPreference -ExclusionExtension .config
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_MpPreference:root\Microsoft\...FT_MpPreference) [Add-MpPreference],
CimException
+ FullyQualifiedErrorId : HRESULT 0x8007007e,Add-MpPreference
This was returning “Failed to modify preferences” on the Add-MpPreference cmdlet and the error code 0x80070073

To fix I needed to uninstall Windows Defender and reboot and then reinstall it.
This was the following cmdlets, with the reboot indicated between them:
Uninstall-WindowsFeature -Name Windows-Defender
#Reboot here
Install-WindowsFeature -Name Windows-Defender
Install-WindowsFeature -Name Windows-Defender-GUI
#Reboot here (again)
Once this was done I was able to add Defender exceptions. The addition of exceptions also failed when done via the Defender Settings application as well (it asks you to authenticate and fails). This also worked after the uninstall/reinstall:

3 responses to “Unable To Update Defender Preferences”
// pls help not working for me //
Uninstall-WindowsFeature : The term ‘Uninstall-WindowsFeature’ is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
That is a valid Windows Server cmdlet: https://learn.microsoft.com/en-us/powershell/module/servermanager/uninstall-windowsfeature?view=windowsserver2022-ps
Uninstall-WindowsFeature is for Windows Server only. For Windows Desktop use Disable-WindowsOptionalFeature and Enable-WindowsOptionalFeature.