Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Powershell Crash

$
0
0

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(...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>