Using Configure-EnterprisePartnerApplication.ps1 in a multi domain controller environment

You use the Configure-EnterprisePartnerApplication.ps1 to create partner application to be used for OAuth with SharePoint 2013 and Lync 2013. The script creates a mail user and assigns management roles to that mail user.

When running the script in an environment with multiple Active Directory domain controllers in the site, you might see the script failing. It happens because it creates the user on one domain controller and then search for it using another domain controller and the search fails.

Creating Partner Application <Lync Enterprise-7da0c6999277459ca10385cb7870b005> using metadata <>.


Created Partner Application <Lync Enterprise-7da0c6999277459ca10385cb7870b005>.


Creating User <Lync Enterprise-ApplicationAccount> for Partner Application.


Couldn’t find object “ Enterprise-ApplicationAccount”. Please make sure that it was spelled correctly or specify a different object.

+ CategoryInfo : NotSpecified: (:) [Set-Mailbox], ManagementObjectNotFoundException

+ FullyQualifiedErrorId : A01C78F0,Microsoft.Exchange.Management.RecipientTasks.SetMailbox

+ PSComputerName :


Created User < Enterprise-ApplicationAccount> for Partner Application.


Assigning role <UserApplication> to Application User < Enterprise-ApplicationAccount>.


Couldn’t find a user with the identity “ Enterprise-ApplicationAccount”.

+ CategoryInfo : NotSpecified: (:) [New-ManagementRoleAssignment], ManagementObjectNotFoundException

+ FullyQualifiedErrorId : 55267DAC,Microsoft.Exchange.Management.RbacTasks.NewManagementRoleAssignment

+ PSComputerName :


The solution is to use the –domaincontroller switch to Configure-EnterprisePartnerApplication.ps1 and specify a domain controller. The script will then use that domain controller for all its operations.

Comments (1)

  1. DanielISz says:

    Thanks a lot! Saved my day 🙂