when i run this code under 1000 machines in Ad it runs fine, over 2000 it crashes powershell every time. any one know why?
Powershell
Import-Moduleactivedirectory$RootDSE=Get-ADRootDSE$configNCDN=$RootDSE.ConfigurationNamingContext$DefaultNamingContext=$RootDSE.defaultNamingContext$Servers=Get-ADObject-SearchBase$DefaultNamingContext-filter{objectClass-eq'Computer'}-Propertiesdnshostname,lastLogonTimestamp$Servers=$Servers|Sort-Object-property$server.lastLogonTimestamp$ServerCount=$Servers.CountIf($Servers){ForEach($serverin$Servers){$ServerNbName=$server.name$ServerFQDN=$server.dNSHostName$ServerDN=$server.DistinguishedName$TPATH="$DefaultPath\$ServerNbName"$ServerCount=$ServerCount-1Write-Host"---------- $ServerFQDN Server Testing: $ServerCount ----------"If($ServerFQDN){If(...