Exchange 2013/2016/2019:- Bulk set OOF for multiple users with different messages.

In Exchange, whether it is Exchange 2010, Exchange 2013, Exchange 2016 or Exchange 2019, you may come across the request to set an Out off Office (OOF or OOO) for users.

Generally when you set OOF for a user, they can do this from Outlook directly but there may come times where you have to set it on Exchange directly.

If you are doing one mailbox, you can use the command below:

  • Set-MailboxAutoreplyConfiguration -Identity user1@domain.com -AutoReplyState Enabled -Internalmessage <Message> -externalmessage <Message>

You can schedule this as well instead of enabling it and you can set a start and end date, all depends on the requirements. Now what happens if you need to schedule OOF for multiple users with different messages?

You can look at a foreach statement to do this and combine that with a csv file. Does not sound too complicated right?

Here is the script below:

$Users = Import-Csv C:\list.csv

foreach ($user in $users) {
   
   	Set-MailboxAutoreplyConfiguration -Identity $User.user -AutoReplyState Enabled -Internalmessage $User.msg -externalmessage $User.msg

}

Let’s expand on what is going on here. First we are importing a CSV file called list.csv in the root of C:\, here is a snippet of what that file looks like:

You can see that I have two headings, User and Msg separated by a comma. Below that is the data, UserA to UserD with the OOF message.

Once run, this is an output for each user, you can see they are all different:

There you have it, a simple script that can set Out of Office for you for multiple users and with multiple messages.

Hope it helps.

You may also like...

Leave a Reply