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 [email protected]
$exchangeSession = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri -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

1 comment

  1. How can I select specified users and set message only for them with powershell?

Comments are closed.