AD.Account.SetGroups
Top  Previous  Next


Sets or edits user account group membership

Category
Active Directory

Script section
All

AD.Account.SetGroups
AccountADPath, GroupADPath1, GroupADPath2 .. GroupADPath10 [Keep OUADPath]

AccountADPath
Full AD path to account  
 
GroupADPath1..GroupADPathX
Comma separated list of full AD paths to groups that the account should be member of (maximum 10)  
 
The account is added to listed groups that it is not already a member of and removed from not listed groups  
The first group in the list is set as primary group  
 
It is possible to keep membership of all groups in a special OU by entering the word "keep" and the Path to the OU as group parameter. This is especially handy for Exchange installations when you want to manage groups without touching the Exchange membership - just specify the OU of the Exchange groups as keep parameter.  

Examples
1) Set group membership for account "Cylba" in "Students" OU in domain "d31.acme.com" to "Domain guests" in "users" container (primary group) and "MyGroup" in "Students" OU.

AD.Account.SetGroups dc=com/dc=acme/dc=D31/ou=students/cn=cylba, dc=com/dc=acme/dc=D31/cn=users/cn=domain guests, dc=com/dc=acme/dc=D31/ou=students/cn=mygroup

2) Set group membership for account "Cylba" in "Students" OU in domain "d31.acme.com" to "Domain guests" in "users" container (primary group) and keep membership of all groups in "student" OU.

AD.Account.SetGroups dc=com/dc=acme/dc=D31/ou=students/cn=cylba, dc=com/dc=acme/dc=D31/cn=users/cn=domain guests, keep dc=com/dc=acme/dc=D31/ou=students