Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from cunninghamp/development
Browse files Browse the repository at this point in the history
Added option to configure Windows Defender on Windows Server 2016 with the required exclusions for Exchange 2016.
  • Loading branch information
cunninghamp committed Sep 28, 2016
2 parents e4d5812 + c8e4156 commit 27e94c4
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Get-Exchange2016AVExclusions.ps1
Expand Up @@ -76,6 +76,15 @@ SOFTWARE.
#requires -version 3


[CmdletBinding()]
param (

[Parameter( Mandatory=$false)]
[switch]$ConfigureWindowsDefender

)


#...................................
# Variables
#...................................
Expand Down Expand Up @@ -392,6 +401,50 @@ if ($IsEdge -or $IsMailbox) {
}


#Configure Windows Defender

if ($ConfigureWindowsDefender) {

if (@(Get-Module Defender -ListAvailable).Count -gt 0) {
write-Host -ForegroundColor Green "Windows Defender PowerShell module available."

$ExclusionPathsList = @(Get-Content $outputfile_paths | Where {$_.ReadCount -gt 2})
foreach ($ExclusionPath in $ExclusionPathsList) {
try {
Add-MpPreference -ExclusionPath $ExclusionPath
}
catch {
Write-Warning $_.Exception.Message
}
}

$ExclusionProcsList = @(Get-Content $outputfile_procs | Where {$_.ReadCount -gt 2})
foreach ($ExclusionProc in $ExclusionProcsList) {
try {
Add-MpPreference -ExclusionProcess $ExclusionProc
}
catch {
Write-Warning $_.Exception.Message
}
}

$ExclusionExtList = @(Get-Content $outputfile_extensions | Where {$_.ReadCount -gt 2})
foreach ($ExclusionExt in $ExclusionExtList) {
try {
Add-MpPreference -ExclusionExtension $ExclusionExt
}
catch {
Write-Warning $_.Exception.Message
}
}

} else {
Write-Warning "Windows Defender PowerShell module not available."
}

}


Write-Host "Done."

#...................................
Expand Down

0 comments on commit 27e94c4

Please sign in to comment.