Powershell – Get AD Sites and Services Info


1. Import the Active Directory module:

Import-Module ActiveDirectory

2. To get the list of Active Directory sites:

Get-ADReplicationSite -Filter *

3. To get the list of subnets:

Get-ADReplicationSubnet -Filter *

4. To get the list of site links:

Get-ADReplicationSiteLink -Filter *

5. To get the list of Domain Controllers and their respective sites:

Get-ADDomainController -Filter * | Format-Table Name, Site

Remember to run these commands in an elevated PowerShell prompt, and you may need the appropriate permissions to retrieve this information. Also, these cmdlets need the Active Directory module for PowerShell, which is typically installed on Domain Controllers or on machines where the Remote Server Administration Tools (RSAT) are installed. If you don’t have the module installed, you might need to install it first.

Always remember to double-check the information you retrieve, and if necessary, compare it to the data in the Sites and Services MMC snap-in.