How to Use a Specific Domain Controller in Exchange 2010 Management Shell

by Paul Cunningham on November 30, 2009

Please help Exchange Server Pro deliver the content that is most valuable to readers by taking this brief Reader Survey. Thanks for visiting!

In a recent post I looked at how to specify a domain controller for use in the Exchange Management Shell for Exchange Server 2007.  In this post I will demonstrate the same technique for Exchange Server 2010.

Any Exchange Management Shell cmdlet will permit you to specify a domain controller using the -DomainController switch.  But you can also set a preferred domain controller for your entire session.

Note the cmdlet to use here – Set-AdServerSettings. This cmdlet configures the session settings such as the preferred Domain Controller and other settings such as the recipient scope.  Check out the full list of Set-AdServerSettings parameters here.

First take a look at the current session settings. In this example dc1.exchangeserverpro.local has been automatically selected.

[PS] C:\>Get-ADServerSettings | fl

RunspaceId                                 : 15e4d968-032b-4cd8-bc66-bf0b665c4161
DefaultGlobalCatalog                       : DC1.exchangeserverpro.local
PreferredDomainControllerForDomain         : {}
DefaultConfigurationDomainController       : DC1.exchangeserverpro.local
DefaultPreferredDomainControllers          : {DC1.exchangeserverpro.local}
UserPreferredGlobalCatalog                 :
UserPreferredConfigurationDomainController :
UserPreferredDomainControllers             : {}
RecipientViewRoot                          : exchangeserverpro.local
ViewEntireForest                           : False
Identity                                   :
IsValid                                    : True

Using Set-ADServerSettings we can specify the preferred server for the current session with the -PreferredServer switch.

[PS] C:\>Set-ADServerSettings -PreferredServer dc2.exchangeserverpro.local

Now Get-ADServerSettings shows this change has occurred.

[PS] C:\>Get-ADServerSettings | fl

RunspaceId                                 : b15cbfd9-5144-442e-bc74-c00a3216b864
DefaultGlobalCatalog                       : dc2.exchangeserverpro.local
PreferredDomainControllerForDomain         : {}
DefaultConfigurationDomainController       : dc2.exchangeserverpro.local
DefaultPreferredDomainControllers          : {DC1.exchangeserverpro.local}
UserPreferredGlobalCatalog                 : dc2.exchangeserverpro.local
UserPreferredConfigurationDomainController : dc2.exchangeserverpro.local
UserPreferredDomainControllers             : {dc2.exchangeserverpro.local}
RecipientViewRoot                          : exchangeserverpro.local
ViewEntireForest                           : False
Identity                                   :
IsValid                                    : True

Did you find this post useful? If so please leave a comment below. You may also subscribe to the RSS feed to receive new posts automatically.

{ 1 comment… read it below or add one }

Bhargav Shukla December 1, 2009 at 4:23 am

You may or may not see this issue I had on Exchange 2007 but good to refer to: http://bit.ly/5KKRXX – Exchange 2007 Setup Error: Setup Cannot use Domain Controller

Leave a Comment