Thursday, February 16, 2012

Exchange 2010 enable mailbox for multiple distribution groups


You can generate mailboxes for multiple distribution groups at the same time, the group names will be read from a text file. To do this:

Open Exchange Management Shell with Administrator rights, then:

Get-Content <OU_LIST_FILE> | Foreach-Object {Enable-DistributionGroup -Identity "$_" -Alias "$_" -DisplayName "$_" -PrimarySMTPAddress "$_@<FQDN_NAME>"}


Example:

Get-Content C:\oulist.txt | Foreach-Object {Enable-DistributionGroup -Identity "$_" -Alias "$_" -DisplayName "$_" -PrimarySMTPAddress "$_@ibs-t.hu"}

-> This will read OU names from the file 'C:\oulist.txt' and create the distribution groups defined in the file, in the domain 'ibs-t.hu'.
It's a simple text file, with the OU names under each other:

---BEGIN FILE---
grpGazd2006
grpGazd2007
---END OF FILE---

Output sample:

Name                          DisplayName                   GroupType                     PrimarySmtpAddress
----                          -----------                   ---------                     ------------------
grpGazd2006                   grpGazd2006                   Universal, SecurityEnabled    grpGazd2006@ibs-t.hu
grpGazd2007                   grpGazd2007                   Universal, SecurityEnabled    grpGazd2007@ibs-t.hu

No comments:

Post a Comment