This must be run in either the Exchange Management Shell or through a remote powershell connection to your Exchange servers.

Out of Office

This one is pretty straightforward—user’s gone from work unexpectedly and you need to set their out of office reply without resetting their password or granting yourself access rights to their account. The script is here:

Set-MailboxAutoReplyConfiguration -Identity domainuser -AutoReplyState Scheduled \
-StartTime "3/20/2018 08:00:00" -EndTime "3/22/2018 08:00:00" \
-InternalMessage "Hello, I'm out of the office on unplanned leave, if you need immediate assistance please contact $Supervisor at SupEmail@domain.name, thank you!" \
-ExternalMessage "Hello, I'm out of the office on unplanned leave, if you need immediate assistance please contact $Supervisor, thank you!" \
-ExternalAudience Known

The command makes use of the Set-MailboxAutoReplyConfiguration cmdlet in powershell. This is mirrored by the Get-MailboxAutoReplyConfiguration cmdlet which will tell you what’s currently set.

Command Options Table

Value Description
Identity The domain username of the user who you’re configuring OOF for.
AutoReplyState Enabled, Disabled, or Scheduled. This lets you set specific times for it to be on, or just permanently on/off if you don’t know the date range.
StartTime and EndTime The start/end dates which are required when AutoReplyState is set to Scheduled. Usage is (including quotes): MM/DD/YYYY HH:MM:SS in 24h format.
InternalMessage The message which will be shown to internal recipients.
ExternalMessage The message which will be shown to external recipients. This may not need to include contact information.
ExternalAudience None, Known, or All. All is default if this is not specified, none will only reply with an OOF message to internal people, and Known will reply to internal emails and anyone who is in the contacts list (GAL and personal one).