Freigeben über


Exchange 2010 - Enabling an Autoreply Message (Out Of Office) using the Exchange Management Shell (Powershell)

 

Here is how to test it on a user first.

1> Using powershell, do a $objMailbox = Get-Mailbox Some_Test_User to get the user we will assign the Out Of Office to.

2> Now define your text (best is to do it in HTML) and store it on 2 variables $InternalMsg and $ExternalMsg like in the example below:

$InternalMsg = "-- Internal Message -- <BR><BR>Hi, <BR><BR>I am not available until next Monday.<BR><BR>For any emergency, please contact my backup John at 613-555-6789.<BR><BR>Jack Doe"

$ExternalMsg = "-- External Message -- <BR><BR>Hi, <BR><BR>I am not available until next Monday.<BR><BR>For any emergency, please contact my backup John at 613-555-6789.<BR><BR>Jack Doe"

clip_image001[4]

3> Now, it’s time to witness the effect of the OOF application on the user’s mailbox.

Open either an Outlook or an Outlook Web App session and check the Out Of Office status, which should be deactivated, with no messages configured (greyed anyways) or some older messages configured :

clip_image002

clip_image003[4]

4> Launch the commandlet against the test user by piping the $ObjMailbox variable we set above with the test user mailbox (UserTest1 in my example):

$objMailbox | Set-MailboxAutoReplyConfiguration -AutoReplyState enabled -ExternalAudience all -InternalMessage $InternalMsg -ExternalMessage $ExternalMsg

clip_image004

5> Check in Outlook or OWA that the message is now set to “Send automatic replies” and also that we have the correct message as defined in the script, for both internal and External OOF messages :

clip_image005[4]

clip_image006

Once you verified it, to apply the OOF to the remainder of the mailboxes, or in my example to all mailboxes containing the string “User”, define your $objMailbox variable with a Get-Mailbox *User* for example, and reapply the powershell command:

$objMailbox | Set-MailboxAutoReplyConfiguration -AutoReplyState enabled -ExternalAudience all -InternalMessage $InternalMsg -ExternalMessage $ExternalMsg

Note: To deactivate the OOF using Powershell on one or more users (depending how many mailboxes you have on the $ObjMailbox variable above), user the following command:

$objMailbox | Set-MailboxAutoReplyConfiguration -AutoReplyState disabled

Comments