PowerShell Genie

Find Defender exclusions

Script 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Get-MpPreference returns the local Defender configuration, and the projection pulls the three exclusion collections covering file paths, process images, and extensions.

The script

1PS> Get-MpPreference | Select-Object ExclusionPath,ExclusionProcess,ExclusionExtension

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 ExclusionPath ExclusionProcess ExclusionExtension
    2 ------------- ---------------- ------------------
    3 C:\Build build.exe .tmp
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-MpPreference | Select-Object ExclusionPath,ExclusionProcess,ExclusionExtension
    1. Stage 1Get-MpPreferencePositional values or no named parameters
    2. Stage 2Select-ObjectPositional values or no named parameters

      How it works

      Get-MpPreference returns the local Defender configuration, and the projection pulls the three exclusion collections covering file paths, process images, and extensions.

      Adapting it

      Join each array through a calculated property before exporting, otherwise the CSV columns hold type names in place of the exclusions the review was supposed to examine.

      Requirements

      Defender present; reading preferences generally works without elevation, which is itself part of the concern.

      If the result is unexpected

      Defender exclusion output looks empty or differs from managed policy.

      The local view, effective management policy and product availability can differ.

      1. Confirm Defender is the active product and compare local exclusion properties with the management policy.

      Validate the result

      The report distinguishes unavailable data from a successful query with no exclusions.

      Keep the check reliable

      Identify the policy owner before changing managed exclusions.

      Primary documentation

      Windows services and processes documentation

      Continue
      Genie guideFind Defender exclusions

      Get-MpPreference returns the local Defender configuration, and the projection pulls the three exclusion collections covering file paths, process images, and extensions.