An Office 365 administrator wanted to how to find out when a user activated their Out of Office message.
You can use the Get-MailboxAutoReplyConfiguration to get the scheduled start and end dates using PowerShell.
For a simple list of start and end times for all users, use this cmdlet.
Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -ne "Disabled" } | Select Identity,StartTime,EndTime,AutoReplyState
If you want the results in a file, you can add the Export-CSV parameter at the end of the cmdlet.
Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState -ne "Disabled" } | Select Identity,StartTime,EndTime,AutoReplyState | Export-CSV OutOfOffice.csv -NoTypeInformation
To see the details for a specific user, use this cmdlet:
Get-MailboxAutoReplyConfiguration -identity alias
In addition to getting the start and end times, you can also change the out of office settings for any user using the Set-MailboxAutoReplyConfiguration cmdlet.
To change the dates, use the StartTime and EndTime parameters. Note: you may need to use UTC time. If you use just the date you donât need to enclose it in quotes, but need to use quotes if you include the time.
Set-MailboxAutoReplyConfiguration âidentity alias âEndTime "9/18/2018 11:00 AM"
To turn Out of Office off use -AutoreplyState disabled and to turn it on, use -AutoReplyState enabled:
Set-MailboxAutoReplyConfiguration âidentity alias âAutoreplyState disabled
To change the Out of Office message, youâll use the InternalMessage and ExternalMessage message parameters.
Set-MailboxAutoReplyConfiguration âidentity alias âInternalMessage "Iâm out of the office today." âExternalMessage "I am out of the office today"
Put it all together like this to enable automatic replies at a specific time and with a specific reply:
Set-MailboxAutoReplyConfiguration -identity alias -AutoReplyState Scheduled -StartTime "9/14/2018 1:00 PM" -EndTime "09/17/2018 11:00 AM" -InternalMessage "I'm out of the office today." -ExternalMessage "I am out of the office today"
Running the PowerShell above shown in the UI:
Incredibly helpful, thank you!
There exists a Power Automate flow named ScheduledOOF that can toggle Automatic Replies (Out Of Office) on/off based on the recursive appointment.
Diane, I am looking to run some of these same commands on a bulk group of users using import-csv. However, I am running into an issue with
-AutoReplyState Enabled
. It is not recognized as a cmdlet, function, script file, or operable program. Any insight? Below is the full code I am trying to run.You don't need the pipe -
Set-MailboxAutoReplyConfiguration -Identity $samAccountName -AutoReplyState Enabled -InternalMessage âCompose your NEW Internal meesage hereâ -ExternalMessage âCompose your NEW External meesage hereâ }