Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Add multiple users to AD Group using AddRange

$
0
0

All,

I am trying to add multiple users to an AD security group using AddRange method but no luck.

Reason why I am using AddRange method is, the memberlist is pretty big (30K users) and Quest or MSFT AD Cmdlets taking plenty of time to add them.

I am following the instruction per http://msdn.microsoft.com/en-in/library/ms180904(v=vs.80).aspx but no luck.

Code snippet:

$groupmembers = Get-Content C:\Temp\MemberDN.txt

$getgroup = [ADSI]"LDAP://CN=MYADGROUP,OU=GROUPS,DC=CONTOSO,DC=COM"

$getgroup.properties.member.AddRange($groupmembers)

#$getgroup.properties["member"].AddRange($groupmembers)

$getgroup.CommitChanges()

#$getgroup.SetInfo()

I tried using ADSPATH as well but no luck.

Any help or pointers are appreciated.

Thanks.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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