Quick add/remove Veeam exceptions for Microsoft Defender

Just upgraded my Homelab’s Veeam Deployment to 12.3 and during the process there was a big warning about having Antivirus exceptions configured properly for Veeam. In my environment I’m also using PostgreSQL as my database back-end for Veeam.

Based on the information provided I whipped up a quick script to add/remove exceptions to Microsoft Defender for Veeam.

The script is specifically for the “Veeam Backup Server” and the general file extension exceptions Veeam recommends in this KB: https://www.veeam.com/kb1999

I also included the Postgres recommendations from https://wiki.postgresql.org/wiki/Running_%26_Installing_PostgreSQL_On_Native_Windows#Antivirus_software

The PostgreSQL exceptions are optional when running the script.

You can grab the latest version of the script from my Gitlab here: https://git.pickysysadmin.ca/eric/veeam-av-exceptions

To run it, launch an Administrative PowerShell session and run one of the following:

# Enable Veeam and Postgres exceptions
.\Set-Veeam-AV-Exceptions.ps1 -action enable -postgres

# Enable Veeam exceptions only
.\Set-Veeam-AV-Exceptions.ps1 -action enable

# Disable Veeam and Postgres exceptions
.\Set-Veeam-AV-Exceptions.ps1 -action disable -postgres

# Disable Veeam exceptions only
.\Set-Veeam-AV-Exceptions.ps1 -action disable

This script has been tested on Windows PowerShell (v5.x) and PowerShell Core (7.x).

6 thoughts on “Quick add/remove Veeam exceptions for Microsoft Defender”

  1. You’re (potentially) adding Veeam CatalogPath and RootFolder to $exceptionPaths, but $exceptionPaths is never initialized and never used elsewhere. I’m guessing lines 92 and 101 should start with “$veeamExceptionPaths +=” ?

    Reply
  2. Also, *.vsm and *.vsm_*tmp have been added to the extensions in KB1999.

    Thanks for the excellent script!

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.