Introduction
Managing Out of Office (OOO) settings across multiple users in Microsoft 365 or Exchange Online can be a tedious task, especially if you’re an administrator handling a large organization. In this blog post, we’ll walk through how to use PowerShell to view both internal and external OOO messages for multiple users. This method is particularly useful for IT admins who want to monitor auto-reply messages for auditing, troubleshooting, or organizational communication consistency.
Prerequisites
Before we begin, ensure the following:
– You have the Exchange Online PowerShell module installed.
– You are connected to Exchange Online.
– You have the necessary admin permissions to run the cmdlets.
PowerShell Script to Fetch OOO Messages
$Mailboxes = import-csv "C:\Users\Desktop\UserInformation.csv"
foreach ($mailbox in $mailboxes) {
Get-MailboxAutoReplyConfiguration -Identity $mailbox.EmailAddress |
Select StartTime, EndTime, ExternalMessage, InternalMessage |
Export-CSV "C:\Users\Desktop\information.csv" -Append -NoTypeInformation -Encoding UTF8
}
Detailed Explanation of the Script
$Mailboxes = import-csv "C:\Users\Desktop\UserInformation.csv"
This line imports a list of users from a CSV file named ‘UserInformation.csv’. Each row in the CSV should contain at least a column named ‘EmailAddress’, which will be used to query each user’s mailbox.
foreach ($mailbox in $mailboxes)
This is a loop that processes each mailbox (i.e., each row in the CSV file).
Get-MailboxAutoReplyConfiguration -Identity $mailbox.EmailAddress
This command retrieves the Out of Office (OOO) configuration for the specified user.
Select StartTime, EndTime, ExternalMessage, InternalMessage
We’re choosing only the essential fields we care about: when the OOO starts, ends, and what messages are set for both internal and external senders.
Export-CSV "C:\Users\Desktop\information.csv" -Append -NoTypeInformation -Encoding UTF8
This writes the selected information to a CSV file called ‘information.csv’. The `-Append` flag ensures each user’s data is added as a new row.
Example Output
Once the script runs successfully, you’ll get a file like this:
StartTime | EndTime | ExternalMessage | InternalMessage
——————- | ——————- | ————————– | ————————–
2025-06-25 09:00:00 | 2025-06-30 17:00:00 | I am on vacation. | I will respond once back.
2025-06-28 00:00:00 | 2025-07-03 23:59:59 | Out of office till July. | Currently away from work.
Conclusion
By using this PowerShell script, administrators can quickly and efficiently audit the Out of Office settings for all users in the organization. This not only saves time but also ensures better communication during employee absences. Make sure your CSV is well-formatted, and you’re good to go!