Thursday, 19 July 2012

Import users form a CSV file to Distribution Group

I have been getting asked lately on how to due bulk user imports into Exchange for various tasks.

The below example will use the user Alias field to add users to a Distribution group.  You can use this method to do other things like make new mailboxes and such.  All you need to do is change the command.  the CSV file should be comma delineated and the first line should say alias since that is what I am using.

Also note I used the alias field you can also use email addresses etc.

Import-CSV c:\users.csv | ForEach {Add-DistributionGroupMember -Identity "DL Name" -Member $_.alias}

1 comment:

  1. If I have a c:\users.csv file with two columns; Alias,DGName, would this modification work?

    Import-CSV c:\users.csv | ForEach {Add-DistributionGroupMember -Identity "$_.DGName" -Member $_.alias}

    Thanks for your thoughts,