sirbounty
asked on
Creating Distribution Groups through powershell
I have a script that creates a distribution group.
Before I create the group, I create a list of valid users - i.e. those that don't throw an exception that they were not found in the directory (Cannot find an object with identity: 'xxxxxx' under: 'DC=xxxxx,DC=xxxxxx,DC=com '.)
So I'm populating a list of valid members and a list of invalid members, to notify the customer of the ones that failed.
This has been working great on small lists, but now that I've tested one with 19k items, (only about 12k are valid) it throws an OutOfMemoryException:
Exception of type 'System.OutOfMemoryExcepti on' was thrown.
+ CategoryInfo : OperationStopped: (:) [], OutOfMemoryException
+ FullyQualifiedErrorId : System.OutOfMemoryExceptio n
Then, shortly after, my 'user not found exception' seems to change to:
A call to SSPI failed, see inner exception.
What's going on and how I can solve this?
Code snippet:
Before I create the group, I create a list of valid users - i.e. those that don't throw an exception that they were not found in the directory (Cannot find an object with identity: 'xxxxxx' under: 'DC=xxxxx,DC=xxxxxx,DC=com
So I'm populating a list of valid members and a list of invalid members, to notify the customer of the ones that failed.
This has been working great on small lists, but now that I've tested one with 19k items, (only about 12k are valid) it throws an OutOfMemoryException:
Exception of type 'System.OutOfMemoryExcepti
+ CategoryInfo : OperationStopped: (:) [], OutOfMemoryException
+ FullyQualifiedErrorId : System.OutOfMemoryExceptio
Then, shortly after, my 'user not found exception' seems to change to:
A call to SSPI failed, see inner exception.
What's going on and how I can solve this?
Code snippet:
import-csv $file | Select-Object -ExpandProperty $header | ForEach-Object { $_.trim() } | ForEach-Object {
try {
$members += @(Get-ADUser $_ -ErrorAction SilentlyContinue)
} catch {
$nonMembers += $_.exception.message
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, wasn't aware of that gdewrell - I'll give it a try on my next run... thanks!
ASKER
thanks MAS - I'll check on those links as well.
http://social.technet.microsoft.com/Forums/en-US/exchangesvrgenerallegacy/thread/fc38558f-fa51-4d75-accc-7139eea881de/
http://social.technet.microsoft.com/Forums/en-US/exchangesvrgenerallegacy/thread/8c071bca-6bdf-48ec-a155-bded3597e075/
If you need more help please let me know