Привет, я обычно использую
ADSISearch вместо
Get-ADComputer
если много компьютеров используйте параллельную обработку:
$credential = Get-Credential DOMAIN\user
$Domain = New-Object -TypeName System.DirectoryServices.DirectoryEntry -ArgumentList $(([adsisearcher]"").SearchRoot.Path), ($credential.UserName), $($credential.GetNetworkCredential().Password)
# поиск ADSI
$Searcher = New-Object -TypeName System.DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = $Domain
$Searcher.Filter = "(&(objectCategory=computer)(operatingSystem=Windows*)(!(operatingSystem=*server*))(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))"
$out = $Searcher.FindAll().Properties.name | ForEach-Object {
# пингуем
Test-Connection -ComputerName $_ -Count 1 -AsJob -ThrottleLimit 128
} | Get-Job | Receive-Job -Wait | Where-Object { $_.StatusCode -eq 0 } | Select-Object Address | ForEach-Object {
}