Remove-WindowsDefenderFeature
Description
This script removes the installed Windows Defender feature on supported Windows Server systems and can optionally restart the server after a successful uninstall.
Requirements
- PowerShell v5 or later
- Run in an elevated PowerShell session (Run as Administrator)
- Windows Server operating system
ServerManagermodule available (Get-WindowsFeaturecommand)- Access to PowerShell Gallery to install or update required module dependencies
Usage
- Verifies the operating system is Windows Server.
- Verifies the
ServerManagermodule is available. - Checks whether
Windows-Defender-FeaturesorWindows-Defenderis installed. - If Defender is installed, uninstalls the detected feature.
- Optionally restarts the server when uninstall completes successfully.
Use this command to remove the installed Windows Defender feature from Windows Server and without a reboot on success.
.\Remove-WindowsDefenderFeature.ps1
Use this command to remove the installed Windows Defender feature from Windows Server and with a reboot on success.
.\Remove-WindowsDefenderFeature.ps1 -ForceRestart
Parameters
| Parameter | Alias | Required | Default | Type | Description |
|---|---|---|---|---|---|
| ForceRestart | False | Switch | Allows the script to restart the machine automatically. |
Output
- Informational and error log entries through the logging framework used by the script
- Optional server restart when feature removal succeeds
Changelog
2026-05-28
- Initial version of the document