Reset Out of Office through PowerShell

Hi

Is it possible to reset Out of Office through PowerShell so that it will return the OOF reply every day?

Lasse

October 14th, 2011 9:52am

Hi

Is it possible to reset Out of Office through PowerShell so that it will return the OOF reply every day?

October 14th, 2011 11:39am

On Fri, 14 Oct 2011 11:39:22 +0000, Sukh828 wrote:   > > >Hi > >Is it possible to reset Out of Office through PowerShell so that it will return the OOF reply every day? > >Lasse >/Lasse > >OOO wont reply everyday for the same user.   It will if you turn it off and back on every day. That's what he's asking about.   --- Rich Matheisen MCSE+I, Exchange MVP  
Free Windows Admin Tool Kit Click here and download it now
October 14th, 2011 9:30pm

thanks for the clarification

October 14th, 2011 10:10pm

Hi LasseF,

As above said, OOF only reply for the same user once unless you turn it off and turn it on per day.

If you really need to do this, you can write a PowerShell script of turn off\on the OOF and schedule it to run once every day :)

Here is a similar thread, but I don't test the script in it, you can have a try.

http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/341ae494-9775-4607-b037-9805cbc3a3

October 17th, 2011 3:35am

Hi Mads

I have added the EWS Managed API and can now use the Get-MailboxAutoReplyConfiguration and Set-MailboxAutoReplyConfiguration. I have run the following:
Get-Mailbox | Get-EWSOofSettings | ?{$_.state -eq "Enabled"} | select identity, state

I get the users with OOF enabled but I also get quite alot of these:
Exception calling "GetUserOofSettings" with "1" argument(s): "Microsoft.Exchang
e.Data.Storage.AccessDeniedException: User is not mailbox owner. User = S-1-5-2
1-725345543-1284227242-682003330-500, MailboxGuid = S-1-5-21-725345543-12842272
42-682003330-3619 ---> User is not mailbox owner. User = S-1-5-21-725345543-128
4227242-682003330-500, MailboxGuid = S-1-5-21-725345543-1284227242-682003330-36
19"
At line:23 char:43
+         $oof = $service.GetUserOofSettings <<<< ($PrimarySmtpAddress)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

I have tried looking up the GUID, but it doesn't seem to belong to a user?

October 17th, 2011 8:23am

As far as I can see the above error message doesn't do anything. I get the list with the users that have OOF enabled.

Now I need to make a PS script that will check which users have OOF enabled and then disable it and enable it, but can't quit figure out how to do it yet, but I am sure that I will find a solution :-)

Free Windows Admin Tool Kit Click here and download it now
October 17th, 2011 9:08am

Hi LasseF,

Thanks for your update. I have a test on the script in the link and it works. After I run the ps script, I can receive the OOF reply again. You can have a try.

Here is the script:

$enabled = get-mailbox -resultsize unlimited |get-mailboxautoreplyconfiguration | where {$_.autoreplystate -eq "enabled"} | select identity,autoreplystate
 
$enabled | foreach-object {
 set-mailboxautoreplyconfiguration $_.identity -autoreplystate "Disabled"
 set-mailboxautoreplyconfiguration $_.identity  -autoreplystate $_.autoreplystate
 } 

 If it works, you can save the script as PS1 file and schedule to run the PS1 file one time a day to achieve your goal.

October 18th, 2011 2:55am

Hi Jack,

I found the solution yesterday. We are running Exchange 2007 SP3 so had to install the EWS API and add the function Get-EWSOofSettings. It works, but I still get the error messages that I posted earlier. I was just worried that I was missing some users with OOF enabled.

$enabled = get-mailbox -resultsize unlimited | Get-EWSOofSettings | where {$_.state -eq "Enabled"} | select identity,state
 
 $enabled | 
 foreach-object {
 Set-EWSOofSettings -Identity $_.identity -State disabled
 Set-EWSOofSettings -Identity $_.identity -State enabled
 }

Free Windows Admin Tool Kit Click here and download it now
October 18th, 2011 6:37am

hi

i am getting the same error

Exception calling "GetUserOofSettings" with "1" argument(s): "Microsoft.Exchange.Data.Storage.AccessDeniedException: Us
er is not mailbox owner. User = S-1-5-21-2573305727-3136801584-897811289-5767, MailboxGuid = S-1-5-21-2573305727-313680
1584-897811289-4798 ---> User is not mailbox owner. User = S-1-5-21-2573305727-3136801584-897811289-5767, MailboxGuid =
 S-1-5-21-2573305727-3136801584-897811289-4798"
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\profile.ps1:1014 char:39
+                 $oof = $service.GetUserOofSettings <<<< ($Identity);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

i am exchange admin

we have exchange 2007 sp3 RU 5

February 13th, 2013 3:37pm

I would like to reset the out of office for a single mailbox or a couple of team mailboxes.

Can you help?

We have some team mailboxes that they want to automaticly reply to every email so our clients know we recieved their email.

I am concerned that if we setup automatic replys we could cause a auto-reply storm.

I would think OOO would work but it would need to be reset daily.

We have an HA system (Casarray's and Mailbox Arrays) with mulitple locations and multiple Mailbox servers. Would I need to run the script on all the Mailbox servers.

Also if you use the exception "except if it is an automatic reply"in an auto-reply rule will that ignore NDR?

Thanks,

Barry

Free Windows Admin Tool Kit Click here and download it now
August 7th, 2013 6:13pm

Hi Barry

It shouldn't matter that you have multiple mailbox servers.

You wrote that you needed auto reply to every mail from your clients, then a daily reset of the OOF won't solve the issue?

I would look at creating a server rule on each mailbox, that responds to received mails and sends back an "auto" reply with the exception "except if it is an automatic reply".

Lasse

August 9th, 2013 6:43am

How long does this script normally take to run?  We have 50 mailboxes on the exchange server.
Free Windows Admin Tool Kit Click here and download it now
April 1st, 2015 11:56am

Hi I can't check the time it takes to run the script since I don't work there anymore But we had around 120 mailboxes and I think it took under 1 minute.
April 2nd, 2015 3:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics