I have a problem with a script to query ActDir. I have found some code to search what I need, but the script stops after some time, "Exception of type 'System.OutOfMemoryException' was thrown". Our AD contains about 4K accounts.What it should do: for every useraccount, check who is member of act.dir group "GPR1_*" and count how many "GRP1_*" for that account.(the get-qaduser is equivalent to get-aduser)[code="plain"]CLS GET-QADUSER -SearchRoot 'mydomain/OU1/OU2' -sizelimit 0 | foreach { $profile = GET-QADUSER -SearchRoot 'mydomain/OU1/OU2' -Name $_.name –Properties name,MemberOf $MembGRP1 = $profile.MemberOf -like "*GRP1_*" $CountGRP1 = $MembGRP1.Count $inp = $_.Name + ";" + $CountGRP1 Write-Host $inp}[/code]Anyone who can help?thx in advance!
↧