Categories

Archives

Reseting OOF state in Exchange 2010

Do you want reset the Out Of Office state for your Users so that the OOF message is not send only once to the sender while the OOF is active? Here is a small script that I’ve created for this. You can add this script to the task scheduler and run it each night. That way the OOF message will be send to each sender every day.

foreach ($obj in (Get-Mailbox  | Get-MailboxAutoReplyConfiguration |`
where {($_.autoreplystate -eq "enabled")`
-or ($_.autoreplystate -eq "scheduled" -and $_.starttime -le ([DateTime]::Now) -and $_.endtime -ge ([DateTime]::Now))}))
{      if ($obj.autoreplystate -match "Enabled")`
           {Set-MailboxAutoReplyConfiguration $obj.identity -AutoReplyState "disabled"
           ;Set-MailboxAutoReplyConfiguration $obj.identity -AutoReplyState "enabled"}
       elseif ($obj.autoreplystate -match "Scheduled")`
           {Set-MailboxAutoReplyConfiguration $obj.identity -AutoReplyState "disabled";
           Set-MailboxAutoReplyConfiguration $obj.identity -AutoReplyState "scheduled";}
}

 

This post is also available in: German, Polish

Comments are closed.