#Sources: http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov06/hey1109.mspx
# http://thepowershellguy.com/blogs/posh/
$objDomain = [ADSI]''
New-Item -ItemType file computers.txt -Force
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = ("(objectCategory=computer)")
$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults) {
$objComputer = $objResult.Properties
$n = $objComputer.name
add-content -path computers.txt -value "$n" -passThru
}