Script agent - problem with domain controllers.
Hello. I'm trying to enforce some policies (in particular, assigning address book policies and disabling OWA/Activesync) on our mailboxes using script agent. I'm using scripting agent configuration like this: <Feature Name="MailboxProvisioning" Cmdlets="enable-mailbox,new-mailbox"> <ApiCall Name="OnComplete"> if($succeeded) { if ($provisioningHandler.UserSpecifiedParameters["Identity"] -ne $null) {$user = $provisioningHandler.UserSpecifiedParameters["Identity"].ToString()} else {$user = $provisioningHandler.UserSpecifiedParameters["Name"].ToString()} if($provisioningHandler.UserSpecifiedParameters["AddressBookPolicy"] -eq $null) { Set-Mailbox $user -AddressBookPolicy ABP_Default } Set-CasMailbox $user -OWAEnabled $false -ActiveSyncEnabled $false } </ApiCall> The problem is that we have three domain controllers in the AD site. So, if I use new-mailbox cmdlet immediately followed by set-mailbox (or any other mailbox or user operation), Exchange can query different domain controllers. AD replication isn't instant, and I got errors because cmdlet cannot find AD object. If I configure all setting by himself, I can use Set-ADServerSettings cmdlet, and all queries in single powershell session will be done to one DC. But mailbox tasks in our organization can be done by different people in different ways, so I want to use scripting agent to enforce correct settings. Is there any way to tell scripting agent to use the same DC in affected cmdlets and in agent's script blocks? The only way that I can think of is to use Set-ExchangeServer to set static DC configuration, but I want to avoid such extreme thing.
September 19th, 2012 5:19am

Hi You can specify the domain controller to be used in each command with the -DomainController parameter. Steve
Free Windows Admin Tool Kit Click here and download it now
September 19th, 2012 5:25am

Yes, I know, but this parameter has to be manually specified. As I said, mailbox tasks can be done by different people in different ways. People can be lazy or forgetful, scripts can't. I want to be sure that correct setting will be enforced even if cmdlets are invoked without full set of correct parameters. I can pass some predefined mailbox properties to cmdlets using "ProvisionDefaultProperties" part of the scripting agent config, but I don't know how to pass -DomainController parameter.
September 19th, 2012 5:42am

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

Other recent topics Other recent topics