Link to home
Start Free TrialLog in
Avatar of btny
btnyFlag for United States of America

asked on

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

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!
Avatar of Joseph Daly
Joseph Daly
Flag of United States of America image

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,
Avatar of btny

ASKER

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.
Avatar of cstrabley
cstrabley

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.
Avatar of btny

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of btny
btny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of btny

ASKER

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