When you create a Teams meeting in Outlook for another user, you get the error:…
Get users that have Out of Office enabled in Exchange
It’s good to know which users are not in the office. For example, you are migrating mailboxes, and you want to confirm if these users had any issues. If you don’t hear anything from them, you assume all is good. What if they are not in their office? To make it easier for you, you can have a list of users with Out of Office enabled. In this article, you will learn how to list users that have Out of Office enabled with PowerShell.
Table of contents
Get users with Out of Office enabled
Run Exchange Management Shell as administrator. We will use the Get-Mailbox and Get-MailboxAutoReplyConfiguration cmdlet. Run the following command.
[PS] C:\>Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -ne "Disabled" } | Select Identity, StartTime, EndTime, AutoReplyState
Identity StartTime EndTime AutoReplyState
-------- --------- ------- --------------
exoip.local/Company/Users/Finance/Amanda Morgan 11/18/2020 12:00:00 AM 11/19/2020 12:00:00 AM Enabled
exoip.local/Company/Users/IT/Boris Campbell 11/18/2020 12:00:00 AM 11/19/2020 12:00:00 AM Enabled
exoip.local/Company/Users/Finance/Dylan Piper 11/18/2020 12:00:00 AM 11/19/2020 12:00:00 AM Enabled
exoip.local/Company/Users/Finance/Irene Springer 11/18/2020 5:00:00 PM 11/26/2020 12:00:00 PM Scheduled
exoip.local/Company/Users/IT/Jonathan Fisher 11/19/2020 7:00:00 PM 11/27/2020 12:00:00 PM Scheduled
exoip.local/Company/Users/HR/Zoë Rees 11/18/2020 12:00:00 AM 11/19/2020 12:00:00 AM Enabled
Do you want to change Out of Office in Exchange Server? Read the article Set automatic replies with PowerShell.
Export users with Out of Office enabled to CSV file
Create a temp folder in the C: drive. To export the results to a CSV file, run the following command. It can take a couple of minutes before the result gets exported to a CSV file.
[PS] C:\>Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -ne "Disabled" } | Select Identity, StartTime, EndTime, AutoReplyState | Export-Csv "c:\temp\OutofOffice.csv" -NoTypeInformation -Encoding UTF8
Go to the path C:\temp and verify that the export went successfully.
Open the CSV file with Microsoft Excel or another application.
Get Out of Office of a single user
Maybe you want to get the Out of Office reply of a single user. For example, the user is named Dylan Piper (dylan.piper@exoip.com). After running the command, you can see that AutoReplyState is Enabled.
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity dylan.piper@exoip.com | Select Identity, StartTime, EndTime, AutoReplyState
Identity StartTime EndTime AutoReplyState
-------- --------- ------- --------------
exoip.local/Company/Users/Finance/Dylan Piper 11/18/2020 12:00:00 AM 11/19/2020 12:00:00 AM Enabled
Keep reading: List all users in a Security Group through PowerShell »
Conclusion
In this article, you learned how to get users that have Out of Office enabled in Exchange. It’s excellent that you can list the users of the entire organization that have the Out of Office enabled or only the users that you insert with PowerShell.
Did you enjoy this article? You may also like Get total user count in Exchange. Don’t forget to follow us and share this article.
Thanks for posting it. Do you know a way to convert the html to plain text to you select “InternalMessage” an “ExternalMessage” and export to csv. Currently I got the exported CSV with ahll the HTML tags included.