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.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s