Add AD contacts (also in a .CSV) to Exchange distribution list

btny
btny used Ask the Experts™
on
Hi,

I have just imported several CSV files into mail enabled contacts in MS Exchange 2010 using this command

Import-Csv C:\Export\EarlyIntervention.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "BoardMembers" }

So now those users are contacts in my AD/MX servers.

I wish to be able to import those members into a distribution list called @BoardMembers howeveer when I run this command

Import-Csv C:\Export\BoardMembers.csv | ForEach-Object -Process { Add-DistributionGroupMember -@BoardMembers -Member $_ }

It doesnt work

Any advice on how to do this is appreciated!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
First guess would be that it doesnt like the @boardmembers as a name. Try it without then and report back. If that doesnt work ill dig deeper,

Author

Commented:
Tried it on a new list called BoardMembers2, didnt work

error message

Cannot process argument transformation on parameter 'Member'. Cannot convert the "@{DisplayName=Kathy Nowak; EmailAddre
ss=knowak@si.rr.com}" value of type "Deserialized.System.Management.Automation.PSCustomObject" to type "Microsoft.Excha
nge.Configuration.Tasks.RecipientIdParameter".
    + CategoryInfo          : InvalidData: (:) [Add-DistributionGroupMember], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Add-DistributionGroupMember
Id edit your post to remove the personal email address there. Let me see if i can duplicate the issue.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Is this group for an Email distribution list? and will the members of the group always be in the same security group?  If so, you can make the list a Dynamic Group, and have membership gereated automatically.

Author

Commented:
It is for a email distri group
membership will change often so I dont think dynamic is ideal

these are also contacts I want added in, not mailboxes
btny, you should include this question in the powershell section.

There is a well known expert by the name of Chris-dent who can probably answer your question fast =]

cheers
Commented:
I did as you said post in the powershell section and got my answer there.

http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26557158.html#a33947595

Author

Commented:
My answer provides a link to the correct answer in another ticket

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial