官术网_书友最值得收藏!

Managing automatic replies and Out of Office settings for a user

In Exchange 2010, we were introduced to a new set of cmdlets that can be used to manage and automate the configuration of a user's Out of Office settings. In this recipe, we'll take a look at how to use these cmdlets from the Exchange Management Shell for Exchange 2013.

How to do it...

Let's see how to manage automatic replies and Out of Office settings using the following steps:

  1. To view the Out of Office settings for a mailbox, use the following syntax:
    Get-MailboxAutoReplyConfiguration dave
    
  2. You can change the Out of Office settings for a mailbox. For example, to disable the Out of Office settings for a mailbox, use the following command:
    Set-MailboxAutoReplyConfiguration dave `-AutoReplyState Disabled
    

How it works...

Retrieving the settings for a mailbox simply requires that you run the Get-MailboxAutoReplyConfiguration cmdlet and specify the identity of the mailbox, as shown in the previous example. The Set-MailboxAutoReplyConfiguration cmdlet supports multiple parameters that can be used to customize the settings used for the mailbox autoreply configuration:

Set-MailboxAutoReplyConfiguration dave `
-AutoReplyState Scheduled `
-StartTime 1/26/2015 `
-EndTime 2/2/2015 `
-ExternalMessage "I will be out of the office this week"

In this command, we set AutoReplyState, specify a StartTime and EndTime, and set ExternalMessage. When the StartTime date is reached, the mailbox will proceed to automatically reply to messages using the specified ExternalMessage cmdlet until the EndTime date is reached. If you want automatic replies to be enabled indefinitely, set AutoReplyState to Enabled.

To view the settings configured in the previous command, we can use the Get-MailboxAutoReplyConfiguration cmdlet, as shown in the following screenshot:

How it works...

You can notice that in the mailbox auto-reply settings for this mailbox, only external replies are enabled. To enable internal Out of Office messages, you can run the previous set command and specify a message using the –InternalMessage parameter. Or, you can use them both using a single command.

The -InternalMessage and -ExternalMessage parameters support HTML-formatted messages. If you want to set custom HTML code when configuring the auto-reply configuration from the shell, you can use the following command syntax:

Set-MailboxAutoReplyConfiguration dave `
-ExternalMessage (Get-Content C:\oof.html)

This command will read in a custom HTML-formatted message from an external file and use that data when setting the internal or external message. This will allow you to work on the file from the HTML editor of your choice and import the code using a simple command from the shell.

By default, the -ExternalAudience parameter will be set to All if no value is specified. The remaining options are Known and None. Setting the external audience to Known will only send automatic replies to external users who are listed as contacts in the users mailbox.

There's more...

These cmdlets can be useful when making mass updates and running reports. For example, to determine all of the users that currently have the Out of Office settings enabled, you can run the following command:

Get-Mailbox –ResultSize Unlimited | 
Get-MailboxAutoReplyConfiguration | 
?{$_.AutoReplyState -ne "Disabled"} | 
Select Identity,AutoReplyState,StartTime,EndTime

This one-liner will check every mailbox in the organization and return only the mailboxes with the auto-reply state set to either Enabled or Scheduled.

Tip

Notice that the Out of Office configuration set by administrators will override any configuration done by the end user.

主站蜘蛛池模板: 久治县| 江城| 通州区| 女性| 武宣县| 洮南市| 成武县| 连江县| 城市| 乐陵市| 仙居县| 浏阳市| 凤凰县| 涞源县| 东乡县| 林芝县| 高邑县| 哈尔滨市| 镇巴县| 东城区| 平潭县| 金平| 洪洞县| 新平| 西安市| 郧西县| 依兰县| 崇明县| 伊通| 姚安县| 青海省| 九龙县| 潜江市| 肇源县| 泽库县| 泌阳县| 中西区| 吐鲁番市| 象州县| 霍州市| 广安市|