Out-of-Office (OOF) messages have to follow the compliance rules as regular email communication. This is not necessarily a known fact to end-users.
If a company does have a strict compliance policy regarding external OOF messages you can use the following solution to establish a strict and simple to-use OOF configuration.
Only specific employees are supposed to send OOF messages to external recipients. All other employees are supposed to send internal OOF messages only.
The solution consists of two PowerShell scripts.
The first script is used to remove any existing OOF rules created by a user using the Outlook OOF Rule Wizard. This is required to avoid any strange behaviors in regards to OOF messages being sent even if OOF is deactivated. The most common reasons for such a behavior are migrated OOF rules created by previous Exchange Server versions.
This script finds and removes all OOF rules for all users using Exchange Web Services (EWS).
This script is supposed to be executed in preparation for the next script.
This script sets the ExternalOofOptions attribute of a user mailbox depending on an Active Directory group membership. After cleaning up all OOF rules in step one, you will be able to control the OOF settings by group membership.
You can read more about scripts here:
- Script 1: Remove Out-Of-Office rules from user mailbox
- Script 2: Set external OOF settings based on AD group membership
You can use the following command line example if you want to automate the execution of script 2 using a scheduled task.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -version 3.0 -command ". 'D:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; "D:\Scripts\Set-ExternalOOF\Set-ExternalOOF.ps1 -RemoveRights"