Google Reviews
If you find this content or our services useful, please leave us a review.

This is a simple PowerShell script to list AD sites and subnets using PowerShell.

$sites = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites           

foreach ($site in $sites) {   
    write-host "(site) $site"    
    foreach ($subnet in $site.Subnets) {
        write-host "....(subnet) $subnet"
        foreach ($server in $site.Servers) {
            write-host "........(server) $server"
        }
    }
}
List AD Sites and Subnets using PowerShell
Comments have now been disabled. If you have a question to ask about this post please ask the community!