how to Set and Get out of office OOF status in Exchange

If you need to check an automatic Out-Of-Office (OOF) reply status for the given mailbox and you do not want to launch Outlook, or simply do not have it installed on the server, there is a quick way to do so. Run the following script in the PowerShell console:
Get-MailboxAutoReplyConfiguration “username”
Replace the “username” phrase with the actual user mailbox name to get the result.
Among other properties, such as the body of the automatic message or activity timeframes, the command returns also the information, whether the automatic reply is enabled or disabled. You can see it in the line titled AutoReplyState.
To get the automatic reply status for all mailboxes in your organization you can use the following command:
Get-Mailbox | Get-MailboxAutoReplyConfiguration
The Get-Mailbox command gathers a list of all mailboxes from your server. The result is then transferred (piped) with the “|” symbol to the Get-MailboxAutoReplyConfiguration.
To filter and show only these users, that actually have the Out-Of-Office enabled, run the following cmdlet:
Get-Mailbox | Get-MailboxAutoReplyConfiguration | Where-Object { $_.AutoReplyState –eq “scheduled” }
As you can see in the above example, another level of data “piping” is applied. The list of all mailboxes is “piped” to the Get-MailboxAutoReplyConfiguration, which is then transferred to the filtering command, that shows only mailboxes with the OOF status “scheduled”.
You can also easily disable the OOF message for the selected mailbox:
Set-MailboxAutoReplyConfiguration -Identity “username” -AutoReplyState Disabled
If the PowerShell scripting is not comfortable enough for your daily use, or you simply prefer a graphical user interface to manage automatic replies, you can use a third-party tool, such as MSH Exchange Autoresponder. With it you can easily and centrally manage not only OOF messages, but also first contact autoreplies, order reception confirmations, set up keyword triggering conditions, schedule activity timeframes and more.

How to set out of office messages by using Exchange 2010 PowerShell

You cannot use HTML characters in Exchange PowerShell directly. Therefore, the HTML characters must be imported through a text file. To do this, follow these steps:

  1. Create an internalmessage.txt document and an externalmessage.txt document that contain the requested messages.Note The placeholders internalmessage and externalmessage represent the names of the text files that contain the out of office messages.
  2. Run the following cmdlets in the Exchange PowerShell window:
    1. $internalmessage = get-content internalmessage.txt
    2. $externalmessage = get-content externalmessage.txt
    3. Set-MailboxAutoReplyConfiguration <alias> -AutoReplyState enabled -ExternalAudience <none/all/known> -InternalMessage "$internalmessage" -ExternalMessage "$externalmessage"

Sometimes, it is desirable to set up both mail forwarding and out of office messages, such as when people have left the company or are on long-term leave. If you enable mail forwarding, you must set the DeliverToMailboxAndForward attribute to True for the out of office message to occur. If this attribute is not set to True, email messages that are sent to the mailbox will be forwarded before they reach the mailbox and will therefore never trigger the out of office message response. To set the DeliverToMailboxAndForward attribute to True, run the following cmdlet:

Set-Mailbox <alias> -ForwardingAddress <recipient> -DeliverToMailboxAndForward $True

Leave a Reply

Your email address will not be published. Required fields are marked *