Thursday, August 18, 2016

Interactive Script to Configure More than One Static Global Catalog

Hi folks,

Just wanted to shared with you a script that will allow you to configured static global catalogs for any Exchange 2010 and later environment. Of course this is not a best practice to hard code global catalogs on Exchange servers according to Microsoft, however reasons may arise why you want to limit your Exchange servers to talk to this or that GC only. Mostly this is due to the performance of GCs which presents risk that an Exchange server can pick up a GC that is low on resources.. When putting together a script I assumed that you want to make static GCs resilient and therefore to configure your server to use 2 GCs. If you want to use more GCs you will need to add variable $GC3. If you want to reduce number of GCs to 1 then you will need to remove all references to $GC2.

The value for each $GCx variable should be a FQDN of a GC.

The code will look like something below:


$GC1 = Read-Host "Type names of Global Catalogs to be used as static GC for exchange. F.e Server1.contoso.net"
$GC2 += Read-Host "If more than one static Glbal Catalog is in use type its name. F.e Server2.contoso.net"
$Server = $(Get-WmiObject Win32_Computersystem).name
Set-ExchangeServer $Server -StaticGlobalCatalogs $GC1,$GC2

Enjoy!