PowerShell script exchange
Post Reply
mtellier
Novice
Posts: 6
Liked: 3 times
Joined: Feb 18, 2016 3:56 pm
Full Name: Mark Tellier
Contact:

Windows Defender - Microsoft-PowerShell-Script

Post by mtellier » Jun 08, 2018 7:15 pm 2 people like this post

Hi Everyone,

As per KB: 1999, Veeam recommends configuring antivirus exclusions for Veeam Servers. I have noticed that under some circumstances, the Veeam Backup and Replication Console can become unresponsive. However, implementing these exclusions resolved the problem. Here is a script I used to configure Windows Defender on a set of Veeam Servers, hope you can use it to get some time back in your day!
Be sure to modify the credential string and list of servers to fit your needs.

Code: Select all

# 6/8/2018
# Mark Tellier
# How to configure antivirus exclusions to prevent interaction with Veeam Backup & Replication
# https://www.veeam.com/kb1999

# Authentication Credentials
$cred = Get-Credential -UserName CORP\mtellier -Message "Enter domain credentials"

# Veeam Servers
$proxy_servers = New-PSSession -Credential $cred -ComputerName `
    proxy1.domain.com,
    proxy2.domain.com,
    proxy3.domain.com,
    proxy4.domain.com,
    proxy5.domain.com

# Exclude Extensions
Invoke-Command -Session $proxy_servers -ScriptBlock {
    $files = @(".vmdk",".flat")
    foreach ($file in $files){
        Write-Output "Adding file exclusion: $file ..."
        Add-MpPreference -ExclusionExtension $file
    }
    Get-MpPreference | Select PSComputerName,ExclusionExtension | Sort PSComputerName,ExclusionProcess
}

# Exclude Processes
Invoke-Command -Session $proxy_servers -ScriptBlock {
    $processes = @("VeeamAgent.exe","VeeamAgent64.exe")
    foreach ($process in $processes){
        Write-Output "Adding file exclusion: $process ..."
        Add-MpPreference -ExclusionProcess $process
    }
    Get-MpPreference | Select PSComputerName,ExclusionProcess | Sort PSComputerName,ExclusionProcess
}

# Exclude Path
Invoke-Command -Session $proxy_servers -ScriptBlock {
    $folders = @("C:\Program Files\Veeam",
    "C:\Program Files(x86)\Veeam",
    "C:\Program Files\Common Files\Veeam",
    "C:\Program Files (x86)\Common Files\Veeam",
    "C:\VeeamFLR",
    "C:\Windows\Veeam",
    "C:\ProgramData\Veeam",
    "D:\VeeamWAN")
    foreach ($folder in $folders){
        Write-Output "Adding folder exclusion: $folder ..."
        Add-MpPreference -ExclusionPath $folder
    }
    Get-MpPreference | Select PSComputerName,ExclusionPath | Sort PSComputerName,ExclusionPath
}

# Close All Sessions
$proxy_servers | Remove-PSSession

Regards,
Mark Tellier

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests