Microsoft Defender Antivirus on Windows Server
Microsoft Defender Antivirus is available in the following editions/versions of Windows Server:
- Windows Server 2022
- Windows Server 2019
- Windows Server, version 1803 or later
- Windows Server 2016
- Windows Server 2012 R2 (Requires Microsoft Defender for Endpoint)
In some instances, Microsoft Defender Antivirus is referred to as Endpoint Protection; however, the protection engine is the same. Although the functionality, configuration, and management are largely the same for Microsoft Defender Antivirus on Windows 10, there are a few key differences on Windows Server:
On Windows Server, automatic exclusions are applied based on your defined Server Role.
On Windows Server, if you are running a non-Microsoft antivirus/antimalware solution, Microsoft Defender Antivirus does not go into either passive mode or disabled mode automatically. However, you can set Microsoft Defender Antivirus to passive or disabled mode manually.
Setting up Microsoft Defender Antivirus on Windows Server
The process of setting up and running Microsoft Defender Antivirus on a server platform includes several steps:
- Enable the interface.
- Install Microsoft Defender Antivirus.
- Verify Microsoft Defender Antivirus is running.
- Update your antimalware Security intelligence.
- (As needed) Submit samples.
- (As needed) Configure automatic exclusions.
- (Only if necessary) Set Windows Server to passive mode.
Enable the user interface on Windows Server
By default, Microsoft Defender Antivirus is installed and functional on Windows Server. Sometimes, the user interface (GUI) is installed by default, but the GUI is not required. You can use PowerShell, Group Policy, or other methods to manage Microsoft Defender Antivirus.
If the GUI is not installed on your server, and you want to install it, either the Add Roles and Features wizard or PowerShell cmdlets.
This option is not available for Windows Server 2012 R2. For more information, see Options to install Microsoft Defender for Endpoint.
Turn on the GUI using the Add Roles and Features Wizard
See Install roles, role services, and features by using the add Roles and Features Wizard, and use the Add Roles and Features Wizard.
When you get to the Features step of the wizard, under Windows Defender Features, select the GUI for Windows Defender option.
In Windows Server 2016, the Add Roles and Features Wizard looks like this:
In Windows Server 2019 and Windows Server 2022, the Add Roles and Feature Wizard is similar.
Turn on the GUI using PowerShell
The following PowerShell cmdlet will enable the interface:
Install-WindowsFeature -Name Windows-Defender-GUI
Install Microsoft Defender Antivirus on Windows Server
If you need to install or reinstall Microsoft Defender Antivirus on Windows Server, you can do that using either the Add Roles and Features Wizard or PowerShell.
Use the Add Roles and Features Wizard to install Microsoft Defender Antivirus
Refer to this article, and use the Add Roles and Features Wizard.
When you get to the Features step of the wizard, select the Microsoft Defender Antivirus option. Also select the GUI for Windows Defender option.
Use PowerShell to install Microsoft Defender Antivirus
To use PowerShell to install Microsoft Defender Antivirus, run the following cmdlet:
Install-WindowsFeature -Name Windows-Defender
Event messages for the antimalware engine included with Microsoft Defender Antivirus can be found in Microsoft Defender AV Events.
Verify Microsoft Defender Antivirus is running
Once Microsoft Defender Antivirus is installed, your next step is to verify that it's running. On your Windows Server endpoint, run the following PowerShell cmdlet:
Get-Service -Name windefend
To verify that firewall protection is turned on, run the following PowerShell cmdlet:
Get-Service -Name mpssvc
As an alternative to PowerShell, you can use Command Prompt to verify that Microsoft Defender Antivirus is running. To do that, run the following command from a command prompt:
sc query Windefend
sc query command returns information about the Microsoft Defender Antivirus service. When Microsoft Defender Antivirus is running, the
STATE value displays
Update antimalware Security intelligence
To get updated antimalware security intelligence, you must have the Windows Update service running. If you use an update management service, like Windows Server Update Services (WSUS), make sure that updates for Microsoft Defender Antivirus Security intelligence are approved for the computers you manage.
By default, Windows Update does not download and install updates automatically on Windows Server 2019 or Windows Server 2022, or Windows Server 2016. You can change this configuration by using one of the following methods:
|Windows Update in Control Panel||Install updates automatically results in all updates being automatically installed, including Windows Defender Security intelligence updates.
Download updates but let me choose whether to install them allows Windows Defender to download and install Security intelligence updates automatically, but other updates are not automatically installed.
|Group Policy||You can set up and manage Windows Update by using the settings available in Group Policy, in the following path: Administrative Templates\Windows Components\Windows Update\Configure Automatic Updates|
|The AUOptions registry key||The following two values allow Windows Update to automatically download and install Security intelligence updates:
4 - Install updates automatically. This value results in all updates being automatically installed, including Windows Defender Security intelligence updates.
3 - Download updates but let me choose whether to install them. This value allows Windows Defender to download and install Security intelligence updates automatically, but other updates are not automatically installed.
To ensure that protection from malware is maintained, we recommend that you enable the following services:
- Windows Error Reporting service
- Windows Update service
The following table lists the services for Microsoft Defender Antivirus and the dependent services.
|Service Name||File Location||Description|
|Windows Defender Service (WinDefend)||
||This is the main Microsoft Defender Antivirus service that needs to be running at all times.|
|Windows Error Reporting Service (Wersvc)||
||This service sends error reports back to Microsoft.|
|Windows Defender Firewall (MpsSvc)||
||We recommend leaving the Windows Defender Firewall service enabled.|
|Windows Update (Wuauserv)||
||Windows Update is needed to get Security intelligence updates and antimalware engine updates|
Sample submission allows Microsoft to collect samples of potentially malicious software. To help provide continued and up-to-date protection, Microsoft researchers use these samples to analyze suspicious activities and produce updated antimalware Security intelligence. We collect program executable files, such as .exe files and .dll files. We do not collect files that contain personal data, like Microsoft Word documents and PDF files.
Submit a file
Enable automatic sample submission
To enable automatic sample submission, start a Windows PowerShell console as an administrator, and set the SubmitSamplesConsent value data according to one of the following settings:
|0 - Always prompt||The Microsoft Defender Antivirus service prompts you to confirm submission of all required files. This is the default setting for Microsoft Defender Antivirus, but is not recommended for installations on Windows Server 2016 or 2019, or Windows Server 2022 without a GUI.|
|1 - Send safe samples automatically||The Microsoft Defender Antivirus service sends all files marked as "safe" and prompts for the remainder of the files.|
|2 - Never send||The Microsoft Defender Antivirus service does not prompt and does not send any files.|
|3 - Send all samples automatically||The Microsoft Defender Antivirus service sends all files without a prompt for confirmation.|
This option is not available for Windows Server 2012 R2.
Configure automatic exclusions
To help ensure security and performance, certain exclusions are automatically added based on the roles and features you install when using Microsoft Defender Antivirus on Windows Server 2016 or 2019, or Windows Server 2022.
Passive mode and Windows Server
If you are using a non-Microsoft antivirus product as your primary antivirus solution on Windows Server, you must set Microsoft Defender Antivirus to passive mode or disabled mode.
For more information, see Install Microsoft Defender Antivirus on Windows Server.
Set Microsoft Defender Antivirus to passive mode using a registry key
You can set Microsoft Defender Antivirus to passive mode by setting the following registry key:
HKLM\SOFTWARE\Policies\Microsoft\Windows Advanced Threat Protection
Disable Microsoft Defender Antivirus using the Remove Roles and Features wizard
See Install or Uninstall Roles, Role Services, or Features, and use the Remove Roles and Features Wizard.
When you get to the Features step of the wizard, clear the Windows Defender Features option.
If you clear Windows Defender by itself under the Windows Defender Features section, you will be prompted to remove the interface option GUI for Windows Defender.
Microsoft Defender Antivirus will still run normally without the user interface, but the user interface cannot be enabled if you disable the core Windows Defender feature.
Turn off the Microsoft Defender Antivirus user interface using PowerShell
To turn off the Microsoft Defender Antivirus GUI, use the following PowerShell cmdlet:
Uninstall-WindowsFeature -Name Windows-Defender-GUI
Are you using Windows Server 2012 R2 or Windows Server 2016?
You can now run Microsoft Defender Antivirus in passive mode on Windows Server 2012 R2 and and Windows Server 2016. For more information, see Options to install Microsoft Defender for Endpoint.
|Disable Microsoft Defender Antivirus using Group Policy||In your Local Group Policy Editor, navigate to Windows Defender, and then select Turn off Windows Defender Antivirus.|
|Disable Microsoft Defender Antivirus using a registry key||To use the the DisableAntiSpyware registry key, navigate to
|Disable Microsoft Defender Antivirus using PowerShell||Use the following PowerShell cmdlet:
|Uninstall Microsoft Defender Antivirus using PowerShell||Use the following PowerShell cmdlet: