Applies To:

GroupID Automate & Management Shell

Business Requirement:

We would like to import multiple criteria-based dynamic groups using a CSV source file. Is this possible?

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.

The 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 - at the Windows prompt.

A sample CSV file with group name and criteria is shown below.

You can use it 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;}


Multiple switches used in this command 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 not falling under the criteria.

For further information about GroupID Management Shell commandlets and switches, check our GroupID Management Shell User Guide.


GroupID Management Shell User Guide

Comments (0)