Categories

S.DS.AD – sites

Sites are the foundation of the physical topology of Active Directory. While there has been a lot posted about working with users and groups i.e. the data in Active Directory there hasn’t been as much posted about working with the physical structure. 

System.DirectoryServices.ActiveDirectory.ActiveDirectorySite gives us one way to access to the site information.

Finding the site our computer is in just needs us to use a static method

$site = [System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite()

This has a number of interesting properties

AdjacentSites
BridgeheadServers
Domains
InterSiteTopologyGenerator
IntraSiteReplicationSchedule
Location
Name
Options
PreferredRpcBridgeheadServers
PreferredSmtpBridgeheadServers
Servers
SiteLinks
Subnets

The servers property lists our domain controllers in the site. If we want to find which domain controllers in our site are also global catalog servers

$site = [System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite()
$site.Servers | Format-Table Name, Domain, @{Label="GC";Expression={$_.IsGlobalCatalog()}} -auto

We take the servers property and use a format-table to display the machine name, the domain (sites are defined at the forest level and can contain multiple domains) and then use a calculated field to determine if a DC is a GC.

 

Technorati Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>