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 [email protected] 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 [email protected] to the desired user account
  • Press Enter and the Out of Office reply is now enabled
Set-MailboxAutoReplyConfiguration -Identity [email protected] -ExternalMessage $body -InternalMessage $body -AutoReplyState Enabled
  • In the example below I am setting the Out of Office reply on the [email protected] mailbox

Turn Off Out of Office Reply

  • Enter the following command replacing [email protected]
    with the desired user account
  • Press Enter
  • The Out of Office Replay has now been disabed
Set-MailboxAutoReplyConfiguration [email protected] –AutoReplyState Disabled –ExternalMessage $null –InternalMessage $null
  • In the example below I am setting the disabling the Out of Office reply on the [email protected] mailbox
Updated on November 19, 2022

Was this article helpful?

Related Articles

Leave a Comment