Exchange scripting agent runs before AD is synchronized

LS,
I have enabled the Exchange 2010 scripting agent.
I updated the scripting agent to execute when a new-mailbox command is given to disable  the POP for the new mailbox.
When I create a new mailbox the scripts is running (oncomplete) but says no object found.(so it doesn't see the mailbox enabled user (user was already in AD).
In our environment we only have 3 domain controllers and all are in one AD site.

Is it possible to say the scripting agent to wait couple ofminutes before running ?

The error I get:
The cmdlet extensionagent with the index 5 has thrown an exception in OnComplete. The Exception is: Microsoft.exchange.provisioning.provisioningexception. Scriptingagent exception thrown while invoking sciptlet for OnComplete API. The operation cound't be performed  because object  'objectname' couldn't be found .  After tja a message that ms.exchange.provisionin.provisioninglayer.oncomplete (task task, Boolean succeede.)

 
June 17th, 2014 10:05am

What you can do is check for the existence of the created object, and if it doesn't exist, wait a little while and try again, and loop some number of times before giving up.
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2014 11:09am

Hi,

Agree with Ed, it is probably that the AD has not yet completed the synchronization.

You should check if all the domain controllers have synced the new object, and then try running scripting agent again.

Thanks.

June 17th, 2014 11:15pm

It can be done in the script.  I've done that kind of thing before.
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2014 11:52pm

Hi,

Any update?

Thanks.

June 24th, 2014 6:07am

Examples of Scripting Agent config to deal with multiple DCs are here:

http://blogs.technet.com/b/rmilne/archive/2014/06/24/exchange-scripting-agent-_2d00_-the-power-of-script.aspx

Give that a shot, and let us know how you get on please.

Free Windows Admin Tool Kit Click here and download it now
June 24th, 2014 6:43pm

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

Other recent topics Other recent topics