Set Out Of Office Message Using PowerShell On Exchange Online Mailbox

This article will show you how to connect to Exchange Online subscription using PowerShell and set an Out Of Office Message On a user mailbox.

To get started you will need to Install all the necessary components and PowerShell modules to connect to Office 365.

Once done, Using ISE paste the 3 line to connect and Import all Exchange Online cmdlet:

$Credential = Get-Credential admin@comanyname.onmicrosoft.com
$exchangeSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession

To set the OOF you will need to use the user’s Alias, to find it use:

Get-mailbox | select alias

Once you have the Alias use the cmdlet below to set the Out Of Office Message on the selected User

Set-MailboxAutoReplyConfiguration admin -AutoReplyState enabled -ExternalAudience all -InternalMessage "Message" -ExternalMessage "Message"

If I log In to the mailbox I will see the message

Leave a Reply