The below is a little example of how to list all mailbox in Office 365 that have an Out of Office or an auto reply setup.
Connecting to exchange
You can either run the command from a local PowerShell session after installing e EXO V2 module. Or I find it easier to use the Cloud Shell from the Exchange Online Admin Centre, up to you.
Method 1 – Cloud Shell
- Browse to and logon to your Exchange Admin centre https://admin.exchange.microsoft.com/
- Click the Cloud Shell icon in the top right. If this is your first time using Cloud Shell you will get a quick setup wizard, just follow the steps
- Enter the command Connect-EXOPSSession to connect to Exchange and wait for the connection to complete
Method 2 – Local PowerShell session
- If you haven’t already you will need to install the Exchange Online PowerShell V2 module by running the command Install-Module -Name ExchangeOnlineManagement
- Run the command Connect-ExchangeOnline -UserPrincipalName <UPN> to logon. Replacing <UPN> with your Office 365 admin username.
Option 1 : List just the identities that have an Out of Office / Auto Reply Set
Get-Mailbox | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -eq "scheduled" } | fl identity
Option 2 : Getting the full details including the message and start and end times
Get-Mailbox | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -eq "scheduled" }
Need to find mailboxes with a forwarding rule?
Take a look at this post Office 365 – List all email forwarding rules (PowerShell)