Skip to content

Send Out of Office reply every day with PowerShell

How to send Out of Office reply every day? You moved from Exchange Server 2010 to Exchange Server 2013 or higher. The Out of Office reply is not sent every day when a message arrives like you are used to. The Out of Office message sends only one time to a sender.

If you have Exchange 2013/2016/2019 or Office 365 and want to send an Out of Office once a day to the sender when a message arrives, you can. This article will teach you how to send an automatic reply once a day.

What is happening?

The user did enable Automatic Replies (Out of Office) in Outlook. The user can enable the same setting in Outlook Web Access (OWA).

Send Out of Office reply every day with PowerShell enable

As an external sender, we will send an email to Christopher. After that, the email lands in his inbox.

Send Out of Office reply every day with PowerShell email arrives

An autoreply message will send automatically. Automatic replies show that it’s working.

Send Out of Office reply every day with PowerShell out of office reply

The user Christopher is on vacation, and his Out of Office is still active. Let’s send an email the next day to Christopher. The email lands again in his inbox. But, this time, we did not get an autoreply message.

Why is this happening, and what is the solution to send an Out of Office reply every day?

Default behavior to send Out of Office reply only once

Since Exchange Server 2013 and all the versions later, think about Exchange 2016/2019 and Exchange Online, an auto reply only sends once to the sender. It’s the default behavior, and there is nothing wrong with your setup.

An example: Three different senders sending an email. All three will get an automatic reply message. The next day they sent an email, but they will not get an Out of Office message this time.

Is there a way to send them an Out of Office reply every day?

Disable and enable Out of Office reply

When the user turns off Out of Office and turns it back on, it will reset the Out of Office count. Now that we know that it’s the default behavior and how to reset the Out of Office count, what’s next? We can’t tell the users to sign in every day to disable and enable their Out of Office. That’s why we need to set up an automated solution to disable and enable the users Out of Office.

The count is reset when you toggle the Out of Office Assistant. Microsoft Exchange clears its internal “sent to” list when you disable the Out of Office Assistant.

Setup Exchange Server Out of Office reply every day

To reset Out of Office in an automated way, we will use PowerShell and Windows Task Scheduler. Download Reset-OOF.ps1 PowerShell script. You can also copy the below content and create a .ps1 file.

# Get all mailboxes with enabled auto reply state
$enabled = Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object {$_.AutoReplyState -eq "Enabled"} | Select-Object Identity, AutoReplyState

# Reset auto reply state
$enabled | ForEach-Object {
    Set-MailboxAutoReplyConfiguration $_.Identity -AutoReplyState "Disabled"
    set-MailboxAutoReplyConfiguration $_.identity -AutoReplyState $_.AutoReplyState
}

On the Exchange Server, save the PowerShell script in C:\scripts folder. If you don’t have a scripts folder, create one.

Send Out of Office reply every day with PowerShell scripts folder

Create a scheduled task and set it to run the Exchange PowerShell script every day. For example, every day at 00:01 AM, it will run the script. It will reset the Out of Office replies every day. Don’t forget that the scheduled task needs to run an Exchange script and not a regular PowerShell script.

Read more: Set automatic replies with PowerShell »

Conclusion

In this article, you learned how to send Out of Office reply every day. Use the Out of Office reset PowerShell script and create a daily task in Windows Task Scheduler. From now on, every day, an automatic reply is sent to the sender. If the sender does not send an email, there will be no automatic reply send.

Did you enjoy this article? You may also like Create send connector in Exchange. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 7 Comments

  1. Hello,
    I let it run via scheduled task and also tried to run it manually. but it seems to not work sometimes.

    Did Microsoft maybe change something here?
    Exchange 2019 Standard, latest CU ….

    My colleagues finde it annoying, since the customers tend to forget someone is on vacation if it is more than just a couple of days…

    best regards,
    David

  2. Why not using a regular Outlook rule with a template from Server?
    Why a scheduled Task on the Exchange farm?

  3. Hello,

    if you use a restricted user (via RBAC) to run the script you must change:

    $_.Identity.

    to

    $_.Identity.ToString()

    Kai

  4. Nice article, thank you!
    Please keep in mind that OOF might be scheduled instead of just enabled. This condition in the Powershell script should do the trick:

    Where-Object {$_.AutoReplyState -eq "Enabled" -or $_.AutoReplyState -eq "Scheduled"}

    By executing

    set-MailboxAutoReplyConfiguration $_.identity -AutoReplyState $_.AutoReplyState

    you already took care of resetting to the original autoreplystate value (enabled or scheduled).

    Florian

    1. Hi again,

      we experienced the problem with the script that after execution scheduled out of office replies have been magically changed to start one day earlier than originally set.
      The following script sets the start and end time again to address this problem:

      $enabled = Get-Mailbox -ResultSize Unlimited | Get-MailboxAutoReplyConfiguration | Where-Object {$_.AutoReplyState -eq "Enabled" -or $_.AutoReplyState -eq "Scheduled"} | Select-Object Identity, AutoReplyState, StartTime, EndTime
      
      $enabled | ForEach-Object {
          $starttime = $_.StartTime
          $endtime = $_.EndTime
          Set-MailboxAutoReplyConfiguration $_.Identity -AutoReplyState "Disabled"
          set-MailboxAutoReplyConfiguration $_.identity -AutoReplyState $_.AutoReplyState -startTime $starttime -EndTime $endtime
      }

Leave a Reply

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