# List-ComputersInOU.ps1 $ou = "OU=Windows11,OU=Workstations,DC=eanet,DC=local" $entry = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$ou") $searcher = New-Object System.DirectoryServices.DirectorySearcher($entry) $searcher.PageSize = 1000 $searcher.Filter = "(&(objectCategory=computer))" $null = $searcher.PropertiesToLoad.Add("name") $results = $searcher.FindAll() Write-Host "Found $($results.Count) computers in: $ou" $results | Select-Object -First 25 | ForEach-Object { $_.Properties["name"][0] }