PowerShell to create Distribution Group in Exchange 2010/Office365


When setting up Office365/Exchange 2010, it is very common to assist the customer to create distribution groups.
This is my way to script it to speed up the creation of the distribution groups:.
1. Create a CSV file for each distribution group. For my case, I have _AllStaff.CSV created. See below link for the sample of the file.
2. Use Powershell and run the following:
$name=”AllStaff”
(The above should be the filename of your CSV file).
New-DistributionGroup -Name “_All Staff” -alias $name -primarysmtpaddress $name@abc.com -memberdepartrestriction closed
(Modify the bold items to the right Distribution Group name and domain name)
Import-csv “D:\$name.csv” | foreach {add-distributiongroupmember -identity $name@abc.com -member $_.EmailAddress}
(Point the location to the CSV file, and also specify the correct distribution group name)
What’s your way in creating the distribution group?
Posted in Office365 | Comments Off on PowerShell to create Distribution Group in Exchange 2010/Office365