Skip to content

Commit 58660dd

Browse files
authored
Merge pull request #1312 from j0shbregman/docs-editor/configure-extension-file-exclu-1725996679
Update configure-extension-file-exclusions-microsoft-defender-antivirus.md
2 parents f82fe62 + 7a2a12c commit 58660dd

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

defender-endpoint/configure-extension-file-exclusions-microsoft-defender-antivirus.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Exclude files from Microsoft Defender Antivirus scans based on thei
44
ms.service: defender-endpoint
55
ms.subservice: ngp
66
ms.localizationpriority: medium
7-
ms.date: 04/03/2024
7+
ms.date: 09/10/2024
88
author: siosulli
99
ms.author: siosulli
1010
ms.topic: conceptual
@@ -30,7 +30,7 @@ search.appverid: met150
3030

3131
- Windows
3232

33-
You can define exclusions for Microsoft Defender Antivirus that apply to [scheduled scans](schedule-antivirus-scans.md), [on-demand scans](run-scan-microsoft-defender-antivirus.md), and [always-on, real-time protection and monitoring](configure-real-time-protection-microsoft-defender-antivirus.md). **Generally, you don't need to apply exclusions**. If you do need to apply exclusions, then you can choose from the following:
33+
You can define exclusions for Microsoft Defender Antivirus that apply to [scheduled scans](schedule-antivirus-scans.md), [on-demand scans](run-scan-microsoft-defender-antivirus.md), and [always-on, real-time protection and monitoring](configure-real-time-protection-microsoft-defender-antivirus.md). **Generally, you don't need to apply exclusions**. If you do need to apply exclusions, then you can choose from the following types:
3434

3535
- Exclusions based on file extensions and folder locations (described in this article)
3636
- [Exclusions for files that are opened by processes](configure-process-opened-file-exclusions-microsoft-defender-antivirus.md)
@@ -46,7 +46,7 @@ See [Recommendations for defining exclusions](configure-exclusions-microsoft-def
4646

4747
## Exclusion lists
4848

49-
To exclude certain files from Microsoft Defender Antivirus scans, modify your exclusion lists. Microsoft Defender Antivirus includes many automatic exclusions based on known operating system behaviors and typical management files, such as those used in enterprise management, database management, and other enterprise scenarios and situations.
49+
To exclude certain files from Microsoft Defender Antivirus scans, modify your exclusion lists. Microsoft Defender Antivirus includes many automatic exclusions based on known operating system behaviors and typical management files, such as those used in enterprise management, database management, and other enterprise scenarios.
5050

5151
> [!NOTE]
5252
> Exclusions apply to [potentially unwanted apps (PUA) detections](detect-block-potentially-unwanted-apps-microsoft-defender-antivirus.md) as well.
@@ -109,21 +109,28 @@ See [How to create and deploy antimalware policies: Exclusion settings](/configm
109109
4. Open the **Path Exclusions** setting for editing, and add your exclusions.
110110

111111
1. Set the option to **Enabled**.
112+
112113
2. Under the **Options** section, select **Show**.
114+
113115
3. Specify each folder on its own line under the **Value name** column.
114-
4. If you are specifying a file, ensure that you enter a fully qualified path to the file, including the drive letter, folder path, file name, and extension.
116+
117+
4. If you're specifying a file, ensure that you enter a fully qualified path to the file, including the drive letter, folder path, file name, and extension.
118+
115119
5. Enter **0** in the **Value** column.
116120

117-
5. Choose **OK**.
121+
6. Choose **OK**.
118122

119-
6. Open the **Extension Exclusions** setting for editing and add your exclusions.
123+
5. Open the **Extension Exclusions** setting for editing and add your exclusions.
120124

121125
1. Set the option to **Enabled**.
126+
122127
2. Under the **Options** section, select **Show**.
128+
123129
3. Enter each file extension on its own line under the **Value name** column.
130+
124131
4. Enter **0** in the **Value** column.
125132

126-
7. Choose **OK**.
133+
5. Choose **OK**.
127134

128135
<a id="ps"></a>
129136

@@ -150,7 +157,7 @@ The following table lists values that you can use in the `<exclusion list>` port
150157
|Exclusion type|PowerShell parameter|
151158
|---|---|
152159
|All files with a specified file extension|`-ExclusionExtension`|
153-
|All files under a folder (including files in sub-directories), or a specific file|`-ExclusionPath`|
160+
|All files under a folder (including files in subdirectories), or a specific file|`-ExclusionPath`|
154161

155162
> [!IMPORTANT]
156163
> If you have created a list, either with `Set-MpPreference` or `Add-MpPreference`, using the `Set-MpPreference` cmdlet again overwrites the existing list.
@@ -188,7 +195,7 @@ See [Add exclusions in the Windows Security app](microsoft-defender-security-cen
188195

189196
## Use wildcards in the file name and folder path or extension exclusion lists
190197

191-
You can use the asterisk `*`, question mark `?`, or environment variables (such as `%ALLUSERSPROFILE%`) as wildcards when defining items in the file name or folder path exclusion list. The way these wildcards are interpreted differs from their usual usage in other apps and languages. Make sure to read this section to understand their specific limitations.
198+
You can use the asterisk `*`, question mark `?`, or environment variables (such as `%ALLUSERSPROFILE%`) as wildcards when defining items in the file name or folder path exclusion list. You can mix and match `*` and `?` and environment variables into a single exclusion. The way these wildcards are interpreted differs from their usual usage in other apps and languages. Make sure to read this section to understand their specific limitations.
192199

193200
> [!IMPORTANT]
194201
> There are key limitations and usage scenarios for these wildcards:
@@ -204,6 +211,7 @@ The following table describes how the wildcards can be used and provides some ex
204211
|`*` (asterisk) <br/><br/> In **file name and file extension inclusions**, the asterisk replaces any number of characters, and only applies to files in the last folder defined in the argument. <br/><br/> In **folder exclusions**, the asterisk replaces a single folder. Use multiple `*` with folder slashes `\` to indicate multiple nested folders. After matching the number of wild carded and named folders, all subfolders are also included.|`C:\MyData\*.txt` includes `C:\MyData\notes.txt` <br/><br/> `C:\somepath\*\Data` includes any file in `C:\somepath\Archives\Data` and its subfolders, and `C:\somepath\Authorized\Data` and its subfolders <br/><br/> `C:\Serv\*\*\Backup` includes any file in `C:\Serv\Primary\Denied\Backup` and its subfolders, and `C:\Serv\Secondary\Allowed\Backup` and its subfolders|
205212
|`?` (question mark) <br/><br/> In **file name and file extension inclusions**, the question mark replaces a single character, and only applies to files in the last folder defined in the argument. <br/><br/> In **folder exclusions**, the question mark replaces a single character in a folder name. After matching the number of wild carded and named folders, all subfolders are also included.|`C:\MyData\my?.zip` includes `C:\MyData\my1.zip` <br/><br/> `C:\somepath\?\Data` includes any file in `C:\somepath\P\Data` and its subfolders <br/><br/> `C:\somepath\test0?\Data` would include any file in `C:\somepath\test01\Data` and its subfolders|
206213
|Environment variables <br/><br/> The defined variable is populated as a path when the exclusion is evaluated.|`%ALLUSERSPROFILE%\CustomLogFiles` would include `C:\ProgramData\CustomLogFiles\Folder1\file1.txt`|
214+
|Mix and Match <br/><br/>Environment variables `*` and `?` can be combined into a single exclusion|`%PROGRAMFILES%\Contoso*\v?\bin\contoso.exe` would include `c:\Program Files\Contoso Labs\v1\bin\contoso.exe`|
207215

208216
> [!IMPORTANT]
209217
> If you mix a file exclusion argument with a folder exclusion argument, the rules stop at the file argument match in the matched folder, and don't look for file matches in any subfolders.
@@ -296,7 +304,7 @@ You can retrieve the items in the exclusion list by using one of the following m
296304
If you use PowerShell, you can retrieve the list in the following two ways:
297305

298306
- Retrieve the status of all Microsoft Defender Antivirus preferences. Each list is displayed on separate lines, but the items within each list are combined into the same line.
299-
- Write the status of all preferences to a variable, and use that variable to only call the specific list you are interested in. Each use of `Add-MpPreference` is written to a new line.
307+
- Write the status of all preferences to a variable, and use that variable to only call the specific list you're interested in. Each use of `Add-MpPreference` is written to a new line.
300308

301309
### Validate the exclusion list by using MpCmdRun
302310

@@ -348,43 +356,35 @@ For more information, see [Use PowerShell cmdlets to configure and run Microsoft
348356

349357
You can validate that your exclusion lists are working by using PowerShell with either the `Invoke-WebRequest` cmdlet or the .NET WebClient class to download a test file.
350358

351-
In the following PowerShell snippet, replace `test.txt` with a file that conforms to your exclusion rules. For example, if you have excluded the `.testing` extension, replace `test.txt` with `test.testing`. If you're testing a path, make sure that you run the cmdlet within that path.
359+
In the following PowerShell snippet, replace `test.txt` with a file that conforms to your exclusion rules. For example, if you're excluding the `.testing` extension, replace `test.txt` with `test.testing`. If you're testing a path, make sure that you run the cmdlet within that path.
352360

353361
```PowerShell
354362
Invoke-WebRequest "https://secure.eicar.org/eicar.com.txt" -OutFile "test.txt"
355363
```
356364

357-
If Microsoft Defender Antivirus reports malware, then the rule is not working. If there is no report of malware and the downloaded file exists, then the exclusion is working. You can open the file to confirm the contents are the same as what is described on the [EICAR test file website](https://www.eicar.org/download-anti-malware-testfile/).
365+
If Microsoft Defender Antivirus reports malware, then the rule isn't working. If there's no report of malware and the downloaded file exists, then the exclusion is working. You can open the file to confirm the contents are the same as what is described on the [EICAR test file website](https://www.eicar.org/download-anti-malware-testfile/).
358366

359-
You can also use the following PowerShell code, which calls the .NET WebClient class to download the test file - as with the `Invoke-WebRequest` cmdlet; replace `c:\test.txt` with a file that conforms to the rule you are validating:
367+
You can also use the following PowerShell code, which calls the .NET WebClient class to download the test file - as with the `Invoke-WebRequest` cmdlet; replace `c:\test.txt` with a file that conforms to the rule you're validating:
360368

361369
```PowerShell
362370
$client = new-object System.Net.WebClient
363371
$client.DownloadFile("http://www.eicar.org/download/eicar.com.txt","c:\test.txt")
364372
```
365373

366-
If you do not have Internet access, you can create your own EICAR test file by writing the EICAR string to a new text file with the following PowerShell command:
374+
If you don't have Internet access, you can create your own EICAR test file by writing the EICAR string to a new text file with the following PowerShell command:
367375

368376
```PowerShell
369377
[io.file]::WriteAllText("test.txt",'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*')
370378
```
371379

372-
You can also copy the string into a blank text file and attempt to save it with the file name or in the folder you are attempting to exclude.
380+
You can also copy the string into a blank text file and attempt to save it with the file name or in the folder you're attempting to exclude.
373381

374-
> [!TIP]
375-
> If you're looking for Antivirus related information for other platforms, see:
376-
> - [Set preferences for Microsoft Defender for Endpoint on macOS](mac-preferences.md)
377-
> - [Microsoft Defender for Endpoint on Mac](microsoft-defender-endpoint-mac.md)
378-
> - [macOS Antivirus policy settings for Microsoft Defender Antivirus for Intune](/mem/intune/protect/antivirus-microsoft-defender-settings-macos)
379-
> - [Set preferences for Microsoft Defender for Endpoint on Linux](linux-preferences.md)
380-
> - [Microsoft Defender for Endpoint on Linux](microsoft-defender-endpoint-linux.md)
381-
> - [Configure Defender for Endpoint on Android features](android-configure.md)
382-
> - [Configure Microsoft Defender for Endpoint on iOS features](ios-configure-features.md)
383382

384383
## See also
385384

386385
- [Configure and validate exclusions in Microsoft Defender Antivirus scans](configure-exclusions-microsoft-defender-antivirus.md)
387386
- [Configure and validate exclusions for files opened by processes](configure-process-opened-file-exclusions-microsoft-defender-antivirus.md)
388387
- [Configure Microsoft Defender Antivirus exclusions on Windows Server](configure-server-exclusions-microsoft-defender-antivirus.md)
389388
- [Common mistakes to avoid when defining exclusions](common-exclusion-mistakes-microsoft-defender-antivirus.md)
389+
390390
[!INCLUDE [Microsoft Defender for Endpoint Tech Community](../includes/defender-mde-techcommunity.md)]

0 commit comments

Comments
 (0)