Dynamic Distribution Groups in bulk using powershell

Here is a small script written by me for creating  Dynamic Distribution Groups in bulk using powershell

#import csv file (script.ps1  csv file)

$data = import-csv $args[0]

#create a vriable for holding condition

 $str = new-object System.Text.Stringbuilder

foreach ($i in $data)

{

# reagd filter (office value from csv file)

$dgp = $i.filter

$str = {(office -eq $dgp)}

New-DynamicDistributionGroup -Name $i.initials -OrganizationalUnit $i.ou -RecipientFilter $str -RecipientContainer $i.domain

}

In the same way you can  crete multiple conditions & create dynamic distribution groups based on various AD attributes.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s