The below PowerShell script will generate a CSV file that lists each replication subnet in Active Directory Sites and Services. The list includes the site associated with the subnet, and whether or not a domain controller is in the site.
This script assumes you have a healthy AD and that your domain controllers are online.
## Get a list of all domain controllers in the forest $DcList = (Get-ADForest).Domains | ForEach { Get-ADDomainController -Discover -DomainName $_ } | ForEach { Get-ADDomainController -Server $_.Name -filter * } | Select Site, Name, Domain ## Get all replication subnets from Sites & Services $Subnets = Get-ADReplicationSubnet -filter * -Properties * | Select Name, Site, Location, Description ## Create an empty array to build the subnet list $ResultsArray = @() ## Loop through all subnets and build the list ForEach ($Subnet in $Subnets) { $SiteName = "" If ($Subnet.Site -ne $null) { $SiteName = $Subnet.Site.Split(',')[0].Trim('CN=') } $DcInSite = $False If ($DcList.Site -Contains $SiteName) { $DcInSite = $True } $RA = New-Object PSObject $RA | Add-Member -type NoteProperty -name "Subnet" -Value $Subnet.Name $RA | Add-Member -type NoteProperty -name "SiteName" -Value $SiteName $RA | Add-Member -type NoteProperty -name "DcInSite" -Value $DcInSite $RA | Add-Member -type NoteProperty -name "SiteLoc" -Value $Subnet.Location $RA | Add-Member -type NoteProperty -name "SiteDesc" -Value $Subnet.Description $ResultsArray += $RA } ## Export the array as a CSV file $ResultsArray | Sort Subnet | Export-Csv .\AD-Subnets.csv -nti