We like to update .NET Framework in Exchange Server 2013/2016/2019 because we want to install…
Set automatic replies with PowerShell
How to set Automatic Replies for another user with PowerShell in Exchange Server? The user has left work and forgot to change his Out of Office in Outlook. He gets many emails and wants to keep his internal colleagues and external partners notified. He asked if it’s possible to change the text in his Out of Office and enable it. In this article, you will learn how to set Automatic Replies with PowerShell in Exchange Server.
Table of contents
- Information
- Get mailbox Automatic Reply status
- Enable Automatic Replies and set internal and external message
- Enable Automatic Replies scheduled time for internal and external messages
- Remove time range in Automatic Replies
- Clear and disable external message in Automatic Replies
- Change external message and enable only for contacts
- Disable Automatic Replies
- Disable Automatic Replies and clear internal and external message
- Conclusion
Information
In our example, we will look at how to get Automatic Reply and set Automatic Reply. After that, we will show a screenshot of the Automatic Replies (Out of Office) configuration in Microsoft Outlook.
Get mailbox Automatic Reply status
Run Exchange Management Shell as administrator. Check if Automatic Reply is enabled on the mailbox of the user. Make use of the cmdlet Get-MailboxAutoReplyConfiguration.
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Disabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 5:00:00 PM
ExternalAudience : All
ExternalMessage :
InternalMessage :
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 5:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
The AutoReplyState value is showing as disabled. This means that Automatic replies are disabled for the user. InternalMessage and ExternalMessage are empty, which means the user does not have any text filled in the text box.
Read more: Get users that have Out of Office enabled in Exchange »
Enable Automatic Replies and set internal and external message
Enable Automatic Replies with a message for both internal and external senders.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Enabled -InternalMessage "Internal auto-reply test." -ExternalMessage "External auto-reply test." -ExternalAudience All
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Enabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 5:00:00 PM
ExternalAudience : All
ExternalMessage : <html>
<body>
External auto-reply test.
</body>
</html>
InternalMessage : <html>
<body>
Internal auto-reply test.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 5:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Now that we have seen how you can change the Automatic Replies of the user, what’s next? There are more options to change the Automatic Replies of the user. Let’s check them out.
Enable Automatic Replies scheduled time for internal and external messages
Enable Automatic Replies with a scheduled time and date starting from 20-8-2020 10:00 till 20/8/2020 12:00.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Scheduled -StartTime "8/20/2020 10:00" -EndTime "8/20/2020 12:00" -InternalMessage "Internal auto-reply test date 20 August." -ExternalMessage "External auto-reply test date 20 August."
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Scheduled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/20/2020 12:00:00 PM
ExternalAudience : All
ExternalMessage : <html>
<body>
External auto-reply test date 20 August.
</body>
</html>
InternalMessage : <html>
<body>
Internal auto-reply test date 20 August.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/20/2020 10:00:00 AM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Remove time range in Automatic Replies
Edit Automatic Replies by removing the time scheduling and edit the internal message.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Enabled -InternalMessage "Internal auto-reply test."
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Enabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 5:00:00 PM
ExternalAudience : All
ExternalMessage : <html>
<body>
External auto-reply test date 20 August.
</body>
</html>
InternalMessage : <html>
<body>
Internal auto-reply test.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 5:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Clear and disable external message in Automatic Replies
Clear and disable the external message in Automatic Replies.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Enabled -InternalMessage "Internal auto-reply test." -ExternalMessage $null -ExternalAudience None
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Enabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 5:00:00 PM
ExternalAudience : None
ExternalMessage :
InternalMessage : <html>
<body>
Internal auto-reply test.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 5:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Change external message and enable only for contacts
Keep the internal message. The external message needs to be changed and configured for his contacts list only.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Enabled -ExternalMessage "External auto-reply test only contacts." -ExternalAudience Known
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Enabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 6:00:00 PM
ExternalAudience : Known
ExternalMessage : <html>
<body>
External auto-reply test only contacts.
</body>
</html>
InternalMessage : <html>
<body>
Internal auto-reply test.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 6:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Disable Automatic Replies
Disable Automatic Replies but keep the messages that you have configured. You can enable Automatic Replies the next time, without entering the text again.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoreplyState Disabled
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Disabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 6:00:00 PM
ExternalAudience : Known
ExternalMessage : <html>
<body>
External auto-reply test only contacts.
</body>
</html>
InternalMessage : <html>
<body>
Internal auto-reply test.
</body>
</html>
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 6:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
Disable Automatic Replies and clear internal and external message
Disable Automatic Replies and clear the internal and external auto-reply messages.
[PS] C:\>Set-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com" -AutoReplyState Disabled -ExternalAudience All -ExternalMessage $null -InternalMessage $null
[PS] C:\>Get-MailboxAutoReplyConfiguration -Identity "James.Paterson@exoip.com"
RunspaceId : ecc5c541-9185-4ecb-b304-2f6a794024c9
AutoDeclineFutureRequestsWhenOOF : False
AutoReplyState : Disabled
CreateOOFEvent : False
DeclineAllEventsForScheduledOOF : False
DeclineEventsForScheduledOOF : False
EventsToDeleteIDs :
EndTime : 8/7/2020 6:00:00 PM
ExternalAudience : All
ExternalMessage :
InternalMessage :
DeclineMeetingMessage :
OOFEventSubject :
StartTime : 8/6/2020 6:00:00 PM
MailboxOwnerId : exoip.local/Company/Users/IT/James Paterson
Identity : exoip.local/Company/Users/IT/James Paterson
IsValid : True
ObjectState : Unchanged
I hope that this helped you to set the Automatic Replies with PowerShell in Exchange Server.
Keep on reading: Search message tracking logs in Exchange »
Conclusion
In this article, you learned how to set Automatic Replies with PowerShell. First, get the Automatic Reply status of the user, then edit the configuration. Not only did you see one option to adjust the Automatic Reply, but you saw many more variations. Microsoft has written a useful document about the Mailbox Automatic Reply configuration.
If you enjoyed this article, you may also like Search and delete email from Exchange user mailbox. Don’t forget to follow us.
Hi Ali,
May be you can help please. We noticed OOF are sent with blank sender, so they are blocked by our antispam.
We opened a ticket to the antispam editor and they replied we had to allow empty inbound sender which is not aceptable for our security.
I assume we can add a sender to OOF but i can’t find any documentations.
Do you perhaps have an idea ?
Thanks !
I have a shared mailbox that had a auto reply configured when the mailbox was on-prem, but that has not transferred to the config of the mailbox since it’s been migrated to EXO.
However when the auto reply is enabled (with a the newer reply message) both the previous on prem auto reply and new auto reply are sent.
Is there anyway of removing this previous auto reply that you know of?
Many thanks.
Great Article!
I’m using Exchange 2019 on-prem, I have some receipts can receive auto-reply and some receipts not receive auto-reply. I also enable auto-reply both inside and outside.
Can you identify this problem?
Thanks!
Read the article Send Out of Office reply every day with PowerShell.