1. Home
  2. Office 365
  3. Use PowerShell to Create an “Out of Office” Reply for Office 365 Users
  1. Home
  2. PowerShell
  3. Use PowerShell to Create an “Out of Office” Reply for Office 365 Users

Use PowerShell to Create an “Out of Office” Reply for Office 365 Users

Have you ever been in a situation where you are required to set an Out of Office reply for a user but dont have access to their mailbox. You can use the commands below to set the reply using PowerShell

  • Once connected via PowerShell you will need to create the text you would like to be set in the Out of Office Reply (This needs to be in HTML format). The script below is an example of the text you can set, I usually create the text in Notepad and copy/paste into PowerShell
  • Press Enter to set
$Body = @"
"Thankyou for your email.  I am currently away from the office </br> </br>
Please contact user@mycompany.com with any requests. </br> </br> 
Thannkyou  </br> </br>
"@
  • Now set the Out of Office reply on the users mailbox by entering the command below. You will need to change the USER@DOMAIN.COM to the desired user account
  • Press Enter and the Out of Office reply is now enabled
Set-MailboxAutoReplyConfiguration -Identity USER@DOMAIN.COM -ExternalMessage $body -InternalMessage $body -AutoReplyState Enabled
  • In the example below I am setting the Out of Office reply on the support@itwalkthroughs.com mailbox

Turn Off Out of Office Reply

  • Enter the following command replacing USERNAME@DOMAIN.COM
    with the desired user account
  • Press Enter
  • The Out of Office Replay has now been disabed
Set-MailboxAutoReplyConfiguration USERNAME@DOMAIN.COM –AutoReplyState Disabled –ExternalMessage $null –InternalMessage $null
  • In the example below I am setting the disabling the Out of Office reply on the support@itwalkthroughs.com mailbox
Updated on April 5, 2019

Was this article helpful?

Related Articles

Leave a Comment