Applies To:
GroupID Automate - Management Shell
Business Requirement:
You would like to import multiple criteria-based dynamic groups using a CSV source file.
More Information:
A Smart Group is a conventional distribution or security group that dynamically maintains its membership based on specified criteria. A Smart Group can be created, modified and updated using GroupID Management Console, Management Shell, and the Self-Service portal, where GroupID Management Shell is used for bulk operations.
New-SmartGroup PowerShell cmdlet is used to create a Smart Group. The example below creates a new mail-enabled, universal, distribution Smart Group in the container specified by the OrganizationalUnit parameter, using the credentials of the user currently logged-on to the identity store.
New-SmartGroup -OrganizationalUnit "OU=Recruiting,DC=HR,DC=Imanami,DC=US" -Name "Smart_Training" -GroupAlias "Smart_Training" -MailEnable True -SamAccountName "Smart_Training" -GroupScope "Universal Group" -Type "Distribution" |
For more information, type the cmdlet: get-help New-SmartGroup –Full.
Now, we have a CSV file with Group Name and Criteria (sample file attached). We will use the file to import groups and their criteria using the cmdlet below.
Import-Csv "c:\smartgroups.csv" | ForEach-Object {New-SmartGroup -Name $_.Name –MailEnable True -OrganizationalUnit "OU=Demo Groups,DC=demo,DC=com " –SamAccountName $_.Name -groupType "Distribution" -GroupScope "Universal Group" -SecurityType "Public" –LdapFilter $_.LDAP -IncludeRecipients " CN=AlbertManson,OU=Demo Users,DC=demo,DC=com " -ExcludeRecipients "CN=AbbeyTucker,OU=Demo Users,DC=demo,DC=com" ; Update-Group -identity $_.Name;} |
Explanation:
We have used multiple switches in this command; important switches are explained below:
$_.Name |
Represents the first column Name in the source file. |
–MailEnable True |
Setting this switch to True allows us to create mail enabled groups. |
$_.LDAP |
Represents the second column in the source file that contains the criteria. |
-IncludeRecipients |
Include exceptions not falling under the criteria. |
-ExcludeRecipients |
Exclude exceptions though not falling under the criteria. |
For further information about GroupID Management Shell and available switches, please check our GroupID Management Shell Guide.
References:
GroupID Management Shell Guide
Comments
0 comments
Please sign in to leave a comment.