Skip to main content

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
  • ServerManager module available (Get-WindowsFeature command)
  • Access to PowerShell Gallery to install or update required module dependencies

Usage

  1. Verifies the operating system is Windows Server.
  2. Verifies the ServerManager module is available.
  3. Checks whether Windows-Defender-Features or Windows-Defender is installed.
  4. If Defender is installed, uninstalls the detected feature.
  5. 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

ParameterAliasRequiredDefaultTypeDescription
ForceRestartFalseSwitchAllows 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