$searcher=new-object system.directoryservices. directorysearcher
$searcher.filter=" objectcategory=computer"
$searcher.sort.propertyname=" name"
$results=$searcher.findall()
write-host "found" $results.count "computers = PCs & Servers"
$results | select @{name="Name";Expression={$_.p roperties.name}} > c:\output\AllWindowsSystems. txt
This uses the directory searcher to connect to the AD, it provides a flat file that can be used to report on each system, all you have to do is edit the output text file and remove the title and this file can be used as an input array.
No comments:
Post a Comment