en-US windows computer

Configure monitoring for incoming and outgoing file and program activity

Verified with Windows 11 25H2 — updated on July 30, 2026

Windows 11 25H2

Supported on: At least Windows Server 2012, Windows 8 or Windows RT

Path in the GPO console

Computer Configuration\Administrative Templates\Windows Components\Microsoft Defender Antivirus\Real-time Protection

Description

This policy setting allows you to configure monitoring for incoming and outgoing files, without having to turn off monitoring entirely. It is recommended for use on servers where there is a lot of incoming and outgoing file activity but for performance reasons need to have scanning disabled for a particular scan direction. The appropriate configuration should be evaluated based on the server role. Note that this configuration is only honored for NTFS volumes. For any other file system type, full monitoring of file and program activity will be present on those volumes. The options for this setting are mutually exclusive: 0 = Scan incoming and outgoing files (default) 1 = Scan incoming files only 2 = Scan outgoing files only Any other value, or if the value does not exist, resolves to the default (0). If you enable this setting, the specified type of monitoring will be enabled. If you disable or do not configure this setting, monitoring for incoming and outgoing files will be enabled.

Registry

HKLM Software\Policies\Microsoft\Windows Defender\Real-Time Protection

Value name: RealtimeScanDirection

More options available

Options

Configure monitoring for incoming and outgoing file and program activity
RealtimeScanDirection enum
  • bi-directional (full on-access) -> 0 (default)
  • scan only incoming (disable on-open) -> 1
  • scan only outgoing (disable on-close) -> 2

MDM / Intune (CSP)

./Device/Vendor/MSFT/Policy/Config/Defender/RealTimeScanDirection
Device Since Windows 10, version 1507 [10.0.10240] and later Official mapping (Microsoft Learn)

Microsoft Learn documentation Mapping data: Microsoft Learn (CC BY 4.0)

CSP values
  • 0 (Default) - Monitor all files (bi-directional).
  • 1 - Monitor incoming files.
  • 2 - Monitor outgoing files.

Export Builder

BETA

Configure the state, scope and options, then generate .reg, PowerShell, Intune and SCCM outputs — or add the setting to a multi-setting collection.

These exports write the registry — this is not a managed GPO.

.reg file

Windows Registry Editor Version 5.00

; Exported from gporais.com
; Policy: Configure monitoring for incoming and outgoing file and program activity
; State: Enabled
; Supported on: At least Windows Server 2012, Windows 8 or Windows RT

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows Defender\Real-Time Protection]
"RealtimeScanDirection"=dword:00000001
"RealtimeScanDirection"=dword:00000000
More formats (PowerShell, Intune, SCCM)

PowerShell

# Exported from gporais.com
# Policy: Configure monitoring for incoming and outgoing file and program activity
# State: Enabled
# Supported on: At least Windows Server 2012, Windows 8 or Windows RT

$path = 'HKLM:\Software\Policies\Microsoft\Windows Defender\Real-Time Protection'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'RealtimeScanDirection' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'RealtimeScanDirection' -Value 0 -Type DWord

Building a multi-setting collection? Add this setting and generate combined .reg / PowerShell / GPO scripts.

Open the Builder

Embed this policy on your site

What to embed
Theme

Adds one script line: the theme follows your site’s appearance and the height fits the content. If your site blocks scripts, the embed follows the visitor’s system theme.

Preview