#Get ADSI connection to the CurrentDomain
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::getcurrentdomain()
#get some info
$dom.Forest.name
$dom.DomainMode
#get domain password policy
$dom.GetDirectoryEntry().pwdHistoryLength
#Get trust relations
$dom.GetAllTrustRelationships() fl
#find a domaincontroller and connect to it
$dc = $dom.finddomaincontroller()
# Get the Forrest
$for = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
#Find ONE GC
$gc = $for.FindGlobalCatalog()
#find all GC in yourSite
$for.FindAllGlobalCatalogs("YourSite")
# without using a DomainObject.
$dt = [System.DirectoryServices.ActiveDirectory.DirectoryContexttype]"domain"
$c = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext($dt)
$dc::findone($c)
October 2005 November 2005 December 2005 January 2006 February 2006 March 2006 April 2006 May 2006 June 2006 July 2006 August 2006 September 2006 October 2006 November 2006 December 2006