Working on an Exchange 2007 system today I revisted a problem where I needed to create a fast distribution list.
Comparing to our Linux friends in sendmail it’s much easier you simply create a file with a list of recipients externally and use them as a valid distribution group. In order to do something like this with exchange we will want to use Bulk Management and include a CSV file for source.
1) Create a CSV file lets name it contacts.csv with a listing of e-mail address recipients externally. These addresses will be added to the exchange server as mail enabled contacts. Store this file in the path on your exchange server, it will be run through Powershell.
2) Shell one-liner like this:
# contacts.csv is a sample csv file containing below columns:
# name,company,department,displayName,targetAddress,mailNickname
import-csv contacts.csv | foreach { new-mailcontact -alias $_.mailnickname -name $_.displayName -ExternalEmailAddress $_.targetaddress -org Users }
We can change ‘-org Users’ with other organizational units such as creating a new one based on this distribution list which i highly recommend to keep your active directory sorted.
For a full listing of parameters used with new-mailcontact in PS check http://technet.microsoft.com/en-us/library/bb124519.aspx.