Friday, April 15, 2016

Reporting AD Sites Used By Exchange

Hi folks,

Last year I was already publishing post about retrieving AD information for Exchange server such as global catalog.

Here are some more codes on retrieving it.

If you're requested to retrieve information about sites which are used by Exchange servers you can use this code (Get-ADSite cmdlet won't return you this information):

Get-ExchangeServer |select Site,Name |sort Site |Export-Csv D:\Scripts\ADSites_W_ExchOnPrem.csv

It will provide information about AD sites and which Exchange servers are installed there. Please note that you will receive the same AD site multiple times because this info is queried from Exchange server.

If you need to retrieve information about AD site links utilized by Exchange let's look into the following scenario. Let's imagine our site name is Atlanta. Since AD site can have more than one link and you may not know all the names you can use wild card sign (*) to find all the possible links that site is using. The code will be something like that:

Get-AdSiteLink *Atlanta* |select Name,AdCost,ExchangeCost,@{N="Sites";E={$_.Sites}} |Export-Csv D:\Scripts\ADSiteLinks.csv -Append

Links with the sites that contain Exchange servers (can be retrieved by the first code) will be those that are used by Exchange to determine route.

Enjoy