Month: June 2014

Powershell : Find all servers in a domainPowershell : Find all servers in a domain

This code will find all servers in a domain and return its canonical location   $objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.Filter = ‘(OperatingSystem=Window*Server*)’ “Name”,”canonicalname”,”distinguishedname” | Foreach-Object {$null = $objSearcher.PropertiesToLoad.Add($_) } $objSearcher.FindAll()