Applies To:
GroupID 9 and 10 - GroupID Management Shell
Business Scenario:
We have a large number of Smart Groups in GroupID. These groups are updated based on their query defined in the Query Designer.
The Query Designer has an Include/Exclude tab, where you can specify objects to include or exclude from group membership (regardless of whether they are fetched by the query).
We want to add or remove a user to the Include list of a specific group using a GroupID Management Shell command.
Steps:
Note: | Before making any changes to your groups, it is recommended to test this first on a ‘test group’ and then implement on the actual group. |
For Adding Users:
Follow these steps to add users to the Include\Exclude list.
-
Launch GroupID Management Shell.
-
Type the following commandlet to add a single user to the Include list:
Set-SmartGroup -identity "group-name" -IncludeRecipients " user-name Note: In ‘user-name’, add the distinguished name OR ‘sAMAccountName’ of the user; otherwise this query will remove all the users from the Include list. Make sure to only use the DN or sAMAccountName. -
To add more than one user or a list of users to the Include list, use the following command:
Set-SmartGroup -identity "group-name" -Add @{IncludeRecipients = "Object1","Object2"} For example:
Set-SmartGroup -identity "test-1" -Add @{IncludeRecipients = "CN=Daisy.Rice,OU=Sales,OU=Lab Users,DC=lab,DC=com","CN=Floyd.Ortiz,OU=Sales,OU=Lab Users,DC=lab,DC=com"}
For the Exclude list, use the same query while replacing ‘IncludeRecipients’ with ‘ExcludeRecipients’.
For Removing Users:
To remove a user from the Include list, use the following command:
Set-SmartGroup -identity "group-name" -Remove @{Includes = "user-name"} |
In the user-name, add the distinguished name or sAMAccountName of a user only.
The same command can be used to remove the users from the Exclude list. Just replace ‘Includes’ with ‘Excludes’.
You can also use this command for a Dynasty by using ‘Set-Dynasty’ instead of ‘Set-SmartGroup’ and the remaining query remains the same.
Reference:
GoupID Management Shell User Guide