PowerShell: Microsoft Exchange Active Directory Integration

Assuming that Exchange is already set and in production, it’s often advisable to record its AD integration settings with these commands:

# View current settings by first importing Exchange PowerShell
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;

# Show static AD server settings of Exchange organization
[PS] C:\Windows\system32>get-adserversettings

ConfigurationDomainCont PreferredDomainControll PreferredGlobalCatalog RecipientViewRoot ViewEntireForest
roller ers
----------------------- ----------------------- ---------------------- ----------------- ----------------
{} INTRA.NET False

# Get a brief summary of Exchange Servers in the intrastructure
[PS] C:\Windows\system32>get-exchangeserver

Name Site ServerRole Edition AdminDisplayVersion
---- ---- ---------- ------- -------------------
CAS INTRA.NET/Co... ClientAc... Enterprise Version 14.3 (Bu...
HUB INTRA.NET/Co... HubTrans... Enterprise Version 14.3 (Bu...
MBX1 INTRA.NET/Co... Mailbox Enterprise Version 14.3 (Bu...
MBX2 INTRA.NET/Co... Mailbox Enterprise Version 14.3 (Bu...
EDGE INTRA.NET/Co... Edge Enterprise Version 14.1 (Bu...

# View extensive details of all Exchange servers
[PS] C:\Windows\system32>get-exchangeserver | FL

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : CAS
DataPath : C:\Program Files\Microsoft\Exchange Server\V14\Mailbox
Domain : INTRA.NET
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=CAS
ExchangeLegacyServerRole : 0
Fqdn : CAS.INTRA.NET
CustomerFeedbackEnabled : False
InternetWebProxy :
IsHubTransportServer : False
IsClientAccessServer : True
IsExchange2007OrLater : True
IsEdgeServer : False
IsMailboxServer : False
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_vns_spp:CAS, netbios:CAS, ncacn_np:CAS, ncacn_spx:CAS, n
cacn_ip_tcp:CAS.INTRA.NET, ncalrpc:CAS}
OrganizationalUnit : INTRA.NET/CAS
AdminDisplayVersion : Version 14.3 (Build 123.4)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : ClientAccess
ErrorReportingEnabled :
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {}
CurrentGlobalCatalogs : {}
CurrentConfigDomainController :
ProductID : 02064-110-8022196-75159
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=CAS,CN=Servers,CN=Exchange Administrative Group (),CN=Admini
strative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configurat
ion,DC=INTRA,DC=NET
Identity : CAS
Guid : d4db9fcd-2f29-4330-a556-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:51 PM
WhenCreated : 2/13/2011 2:37:25 PM
WhenChangedUTC : 7/8/2019 5:57:51 AM
WhenCreatedUTC : 2/13/2011 10:37:25 PM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : HUB
DataPath : C:\Program Files\Microsoft\Exchange Server\V14\Mailbox
Domain : INTRA.NET
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=HUB
ExchangeLegacyServerRole : 0
Fqdn : HUB.INTRA.NET
CustomerFeedbackEnabled : False
InternetWebProxy :
IsHubTransportServer : True
IsClientAccessServer : False
IsExchange2007OrLater : True
IsEdgeServer : False
IsMailboxServer : False
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_vns_spp:HUB, netbios:HUB, ncacn_np:HUB, ncacn_spx:HUB, n
cacn_ip_tcp:HUB.INTRA.NET, ncalrpc:HUB}
OrganizationalUnit : INTRA.NET/HUB
AdminDisplayVersion : Version 14.3 (Build 123.4)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : HubTransport
ErrorReportingEnabled :
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {}
CurrentGlobalCatalogs : {}
CurrentConfigDomainController :
ProductID : 02064-110-8022196-75116
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=HUB,CN=Servers,CN=Exchange Administrative Group (),CN=Admini
strative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configurat
ion,DC=INTRA,DC=NET
Identity : HUB
Guid : e6d9a2b5-1011-4637-88d3-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:52 PM
WhenCreated : 3/7/2011 10:10:36 AM
WhenChangedUTC : 7/8/2019 5:57:52 AM
WhenCreatedUTC : 3/7/2011 6:10:36 PM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : MBX1
DataPath : C:\Program Files\Microsoft\Exchange Server\V14\Mailbox
Domain : INTRA.NET
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=MBX1
ExchangeLegacyServerRole : 0
Fqdn : MBX1.INTRA.NET
CustomerFeedbackEnabled : False
InternetWebProxy :
IsHubTransportServer : False
IsClientAccessServer : False
IsExchange2007OrLater : True
IsEdgeServer : False
IsMailboxServer : True
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_vns_spp:MBX1, netbios:MBX1, ncacn_np:MBX1, ncacn_spx:MBX
1, ncacn_ip_tcp:MBX1.INTRA.NET, ncalrpc:MBX1}
OrganizationalUnit : INTRA.NET/MBX1
AdminDisplayVersion : Version 14.3 (Build 123.4)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : Mailbox
ErrorReportingEnabled :
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {}
CurrentGlobalCatalogs : {}
CurrentConfigDomainController :
ProductID : 02064-110-8022196-75259
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=MBX1,CN=Servers,CN=Exchange Administrative Group (),CN=Admin
istrative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configura
tion,DC=INTRA,DC=NET
Identity : MBX1
Guid : bd6fd21c-f15e-4cbe-ae31-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:52 PM
WhenCreated : 3/17/2011 9:48:45 PM
WhenChangedUTC : 7/8/2019 5:57:52 AM
WhenCreatedUTC : 3/18/2011 4:48:45 AM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : MBX2
DataPath : C:\Program Files\Microsoft\Exchange Server\V14\Mailbox
Domain : INTRA.NET
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=MBX2
ExchangeLegacyServerRole : 0
Fqdn : MBX2.INTRA.NET
CustomerFeedbackEnabled : False
InternetWebProxy :
IsHubTransportServer : False
IsClientAccessServer : False
IsExchange2007OrLater : True
IsEdgeServer : False
IsMailboxServer : True
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_vns_spp:MBX2, netbios:MBX2, ncacn_np:MBX2, ncacn_spx:MBX
2, ncacn_ip_tcp:MBX2.INTRA.NET, ncalrpc:MBX2}
OrganizationalUnit : INTRA.NET/MBX2
AdminDisplayVersion : Version 14.3 (Build 123.4)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : Mailbox
ErrorReportingEnabled :
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {}
CurrentGlobalCatalogs : {}
CurrentConfigDomainController :
ProductID : 02064-110-8022196-75059
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=MBX2,CN=Servers,CN=Exchange Administrative Group (),CN=Admin
istrative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configura
tion,DC=INTRA,DC=NET
Identity : MBX2
Guid : 7da3d484-f844-4701-85db-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:52 PM
WhenCreated : 3/17/2011 11:05:37 PM
WhenChangedUTC : 7/8/2019 5:57:52 AM
WhenCreatedUTC : 3/18/2011 6:05:37 AM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : EDGE
DataPath :
Domain : intra.net
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=EDGE
ExchangeLegacyServerRole : 0
Fqdn : EDGE.intra.net
CustomerFeedbackEnabled :
InternetWebProxy :
IsHubTransportServer : False
IsClientAccessServer : False
IsExchange2007OrLater : True
IsEdgeServer : True
IsMailboxServer : False
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_ip_tcp:EDGE.intra.net}
OrganizationalUnit : intra.net/EDGE
AdminDisplayVersion : Version 14.1 (Build 218.15)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : Edge
ErrorReportingEnabled :
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {}
CurrentGlobalCatalogs : {}
CurrentConfigDomainController :
ProductID : 02064-110-8022196-75922
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=EDGE,CN=Servers,CN=Exchange Administrative Group (),CN=Admin
istrative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configura
tion,DC=INTRA,DC=NET
Identity : EDGE
Guid : c0079eed-f39b-482d-97d7-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:52 PM
WhenCreated : 2/13/2013 11:10:18 PM
WhenChangedUTC : 7/8/2019 5:57:52 AM
WhenCreatedUTC : 2/14/2013 7:10:18 AM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

# View Detail of 1 Exchange Server
[PS] C:\Windows\system32>Get-ExchangeServer -Identity CAS.INTRA.NET -Status | FL

RunspaceId : d97af2c7-d1a9-4012-bd77-
Name : CAS
DataPath : C:\Program Files\Microsoft\Exchange Server\V14\Mailbox
Domain : INTRA.NET
Edition : Enterprise
ExchangeLegacyDN : /o=Intranet/ou=Exchange Administrative Group ()/cn=Configuratio
n/cn=Servers/cn=CAS
ExchangeLegacyServerRole : 0
Fqdn : CAS.INTRA.NET
CustomerFeedbackEnabled : False
InternetWebProxy :
IsHubTransportServer : False
IsClientAccessServer : True
IsExchange2007OrLater : True
IsEdgeServer : False
IsMailboxServer : False
IsE14OrLater : True
IsProvisionedServer : False
IsUnifiedMessagingServer : False
NetworkAddress : {ncacn_vns_spp:CAS, netbios:CAS, ncacn_np:CAS, ncacn_spx:CAS, n
cacn_ip_tcp:CAS.INTRA.NET, ncalrpc:CAS}
OrganizationalUnit : INTRA.NET/CAS
AdminDisplayVersion : Version 14.3 (Build 123.4)
Site : INTRA.NET/Configuration/Sites/DistrictOffice
ServerRole : ClientAccess
ErrorReportingEnabled : False
StaticDomainControllers : {}
StaticGlobalCatalogs : {}
StaticConfigDomainController :
StaticExcludedDomainControllers : {}
CurrentDomainControllers : {AD02.INTRA.NET, AD01.INTRA.NET, ADPDC.INTRA.NET}
CurrentGlobalCatalogs : {AD01.INTRA.NET, ADPDC.INTRA.NET, AD02.INTRA.NET}
CurrentConfigDomainController : AD01.INTRA.NET
ProductID : 02064-110-8022196-75159
IsExchange2007TrialEdition : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod : 00:00:00
IsValid : True
ExchangeVersion : 0.1 (8.0.535.0)
DistinguishedName : CN=CAS,CN=Servers,CN=Exchange Administrative Group (),CN=Admini
strative Groups,CN=someschooldistrict,CN=Microsoft Exchange,CN=Services,CN=Configurat
ion,DC=INTRA,DC=NET
Identity : CAS
Guid : d4db9fcd-2f29-4330-a556-
ObjectCategory : INTRA.NET/Configuration/Schema/ms-Exch-Exchange-Server
ObjectClass : {top, server, msExchExchangeServer}
WhenChanged : 7/7/2019 10:57:51 PM
WhenCreated : 2/13/2011 2:37:25 PM
WhenChangedUTC : 7/8/2019 5:57:51 AM
WhenCreatedUTC : 2/13/2011 10:37:25 PM
OrganizationId :
OriginatingServer : AD01.INTRA.NET

The output above indicates that dynamic AD Settings have been set. Most likely, that is preferred so that Exchange organization can adapt to any DC changes in the domain. In the cases where static DC entries must be set, here are some commands to make it so:

# Set Static variables
$dc1="DC1.intra.net"
$dc2="DC2.intra.net"
$exchangeServers=Get-ExchangeServer | select Name

# set the StaticDomainControllers for all Exchange servers
$exchangeServers | %{Set-ExchangeServer -Identity $_.Name -StaticDomainControllers $dc1,$dc2}
# set the StaticGlobalCatalogs for all Exchange servers
$exchangeServers | %{Set-ExchangeServer -Identity $_.Name -StaticGlobalCatalogs $dc1,$dc2}

# Set Exchange AD server settings
$globalCatalog="ADPDC.intra.net"
$preferredDCs="ADPDC.intra.net","AD01.intra.net"
Set-AdServerSettings -ViewEntireForest $true -PreferredGlobalCatalog $globalCatalog -PreferredDomainControllers $preferredDCs

Leave a Reply

Your email address will not be published. Required fields are marked *