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:
- 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.
- Run the following cmdlets in the Exchange PowerShell window:
$internalmessage = get-content internalmessage.txt
$externalmessage = get-content externalmessage.txt
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