#SearchForAllusers.ps1 [ADSISearcher]$searcher="(&(objectcategory=person)(objectclass=user))" #enable paged searching $searcher.pagesize=50 $users=$searcher.FindAll() #display the number of users Write-Host "There are $($users.count) users in this domain." -foregroundcolor cyan #display each user's distinguishedname foreach ($user in $users) { Write-Host $user.properties.distinguishedname -foregroundcolor green }