-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathConfigure-WindowsDefenderAntivirus-Antivirus-Exclusions-MicrosoftAzureBackupServerv3.ps1
71 lines (51 loc) · 3.24 KB
/
Configure-WindowsDefenderAntivirus-Antivirus-Exclusions-MicrosoftAzureBackupServerv3.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<#
.SYNOPSIS
A script used to configure antivirus exclusions in Windows Defender antivirus for Microsoft Azure Backup Server (MABS) v3.
.DESCRIPTION
A script used to configure antivirus exclusions in Windows Defender antivirus for Microsoft Azure Backup Server (MABS) v3.
.NOTES
File Name: Configure-WindowsDefenderAntivirus-Antivirus-Exclusions-MicrosoftAzureBackupServerv3.ps1
Created: 23/08/2021
Last modified: 23/08/2021
Author: Wim Matthyssen
PowerShell: 5.1 or above
Requires: -RunAsAdministrator
OS: Windows Server 2019
Version: 3.0
Action: Change variables were needed to fit your needs
Disclaimer: This script is provided "As Is" with no warranties.
.EXAMPLE
.\Configure-WindowsDefenderAntivirus-Antivirus-Exclusions-MicrosoftAzureBackupServerv3.ps1
.LINK
https://tinyurl.com/8dpbwbne
#>
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Variables
$global:currenttime= Set-PSBreakpoint -Variable currenttime -Mode Read -Action {$global:currenttime= Get-Date -UFormat "%A %m/%d/%Y %R"}
$foregroundColor1 = "Red"
$foregroundColor2 = "Yellow"
$writeEmptyLine = "`n"
$writeSeperatorSpaces = " - "
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Check if running as Administrator, otherwise close the PowerShell window
$CurrentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$IsAdministrator = $CurrentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if ($IsAdministrator -eq $false) {
Write-Host ($writeEmptyLine + "# Please run PowerShell as Administrator" + $writeSeperator + $currentTime)`
-foregroundcolor $foregroundColor1 $writeEmptyLine
Start-Sleep -s 5
exit
}
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Add custom MABS v3 exclusions
Add-MpPreference -ExclusionProcess "DPMRA.exe"
Add-MpPreference -ExclusionProcess "csc.exe"
Add-MpPreference -ExclusionProcess "cbengine.exe"
Add-MpPreference -ExclusionPath "C:\Program Files\Microsoft Azure Backup Server\DPM\DPM\Temp\MTA"
Add-MpPreference -ExclusionPath "C:\Program Files\Microsoft Azure Backup Server\DPM\DPM\XSD\"
Add-MpPreference -ExclusionPath "C:\Program Files\Microsoft Azure Backup Server\DPM\DPM\bin"
Add-MpPreference -ExclusionPath "C:\Progam Files\Microsoft Azure Backup Server\DPM\MARS\Microsoft Azure Recovery Services Agent\bin"
Add-MpPreference -ExclusionPath "C:\Program Files\Microsoft Azure Backup Server\DPM\DPM\Cache"
Write-Host ($writeEmptyLine + "# Custom MABS v3 exclusions added" + $writeSeperatorSpaces + $currentTime)`
-foregroundcolor $foregroundColor1 $writeEmptyLine
## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------