Trying to add contacts with more than one email address

970 views
Skip to first unread message

Dayrak Ahmadipour

unread,
Feb 26, 2019, 8:22:22 PM2/26/19
to ntpowe...@googlegroups.com, Dayrak Ahmadipour

Hello All,

Ā 

I run the following script to add external email addresses to distribution group in exchange 2013:

Ā 

Import-CSV C:\A.csv | ForEach {Add-DistributionGroupMember -Identity "B" -Member $_.Name}

Ā 

The CSV file is based on name.

Ā 

Error message:

-Ā Ā Ā Ā Ā  There are multiple recipients matching the identity "X Y". Please specify a unique value.

Ā Ā Ā + CategoryInfoĀ Ā Ā Ā Ā Ā Ā Ā Ā  : NotSpecified: (:) [Add-DistributionGroupMember], ManagementObjectAmbiguousException

Ā Ā Ā  + FullyQualifiedErrorId : [Server=xxx,RequestId=xxx,TimeStamp=26/02/2019 10:1

Ā Ā  7:54 PM] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException] 1018D273,Microsoft.Exchange.Management.Recipi

Ā  entTasks.AddDistributionGroupMember

Ā Ā Ā  + PSComputerNameĀ Ā Ā Ā Ā Ā Ā  : xxx

Ā 

OR

Ā 

-Ā Ā Ā Ā Ā  The recipient "Z Yā€ is already a member of the group "xxx".

Ā 

How is that possible to add contacts per their email addresses?

Ā 

Kind regards,

Dayrak

Ā 

Michael B. Smith

unread,
Feb 26, 2019, 11:37:47 PM2/26/19
to ntpowe...@googlegroups.com

Use unique names.

--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To post to this group, send email to ntpowe...@googlegroups.com.
Visit this group at https://groups.google.com/group/ntpowershell.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/SYBPR01MB319376844BFD413C4FD43E34E0740%40SYBPR01MB3193.ausprd01.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Wright, John M

unread,
Feb 27, 2019, 9:17:57 AM2/27/19
to ntpowe...@googlegroups.com

I’d never done this but I thought it was an interesting question so I found out.

Ā 

To add one external contact, I had to do this:

Ā 

  1. Create a Contact object in AD with the person’s name, then add his email address.
  2. Add the contact to the group like this: Add-ADGroupMember -Identity "foo group" -Members "john wright"

Ā 

The question after that is how to convert the CSV rows to contact objects.

Ā 

This command works:

Ā 

New-ADObject -type contact -path 'ou=foo,DC=subdomain,DC=domain,DC=root-Name "John Wright" -OtherAttributes @{'mail'="m...@something.com"}

Ā 

So I think you’ll want a couple of routines.Ā  One to feed the CSV to the new-adobject command and create the contact objects.Ā  Then a second routine to use the CSV again to select those objects and add them to the distribution groups.

Ā 

--

John Wright

IT Support Analyst

Please submit IT requests to Hazelwoo...@bluegrass.org

502-708-9953

1800 Old Bluegrass Avenue, Louisville, KY 40215

24 Hour Helpline 1.800.928.8000

Ā Ā 

CONFIDENTIALITY NOTICE: This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.

Ā 

From: ntpowe...@googlegroups.com <ntpowe...@googlegroups.com> On Behalf Of Dayrak Ahmadipour
Sent: Tuesday, February 26, 2019 8:22 PM
To: ntpowe...@googlegroups.com
Cc: Dayrak Ahmadipour <DAhma...@netintellect.com.au>
Subject: [ntpowershell] Trying to add contacts with more than one email address

Ā 

Hello All,

Ā 

I run the following script to add external email addresses to distribution group in exchange 2013:

Ā 

Import-CSV C:\A.csv | ForEach {Add-DistributionGroupMember -Identity "B" -Member $_.Name}

Ā 

The CSV file is based on name.

Ā 

Error message:

  • There are multiple recipients matching the identity "X Y". Please specify a unique value.

Ā Ā Ā + CategoryInfoĀ Ā Ā Ā Ā Ā Ā Ā Ā  : NotSpecified: (:) [Add-DistributionGroupMember], ManagementObjectAmbiguousException

Ā Ā Ā  + FullyQualifiedErrorId : [Server=xxx,RequestId=xxx,TimeStamp=26/02/2019 10:1

Ā Ā  7:54 PM] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException] 1018D273,Microsoft.Exchange.Management.Recipi

Ā  entTasks.AddDistributionGroupMember

Ā Ā Ā  + PSComputerNameĀ Ā Ā Ā Ā Ā Ā  : xxx

Ā 

OR

Ā 

  • The recipient "Z Yā€ is already a member of the group "xxx".

Ā 

How is that possible to add contacts per their email addresses?

Ā 

Kind regards,

Dayrak

Ā 

--

Dayrak Ahmadipour

unread,
Mar 1, 2019, 12:20:25 AM3/1/19
to ntpowe...@googlegroups.com

Hello John,

Ā 

Thanks for your response.

Ā 

I did the following steps:

Ā 

Ā·Ā Ā Ā Ā Ā Ā Ā Ā  Ā Import-Csv C:\ExternalContacts.csv|%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName}

CSV file was based on ( ExternalEmailAddress,DisplayName,FirstName and Lastname)

Ā 

Ā·Ā Ā Ā Ā Ā Ā Ā Ā  Import-CSV C:\AddToGroup.csv | ForEach {Add-DistributionGroupMember -Identity "DG" -Member $_.Alias}

CSV file had just one column name Alias.

Ā 

Ā 

Kind regards,

Dayrak

-Ā Ā Ā Ā Ā  There are multiple recipients matching the identity "X Y". Please specify a unique value.

Ā Ā Ā + CategoryInfoĀ Ā Ā Ā Ā Ā Ā Ā Ā  : NotSpecified: (:) [Add-DistributionGroupMember], ManagementObjectAmbiguousException

Ā Ā Ā  + FullyQualifiedErrorId : [Server=xxx,RequestId=xxx,TimeStamp=26/02/2019 10:1

Ā Ā  7:54 PM] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException] 1018D273,Microsoft.Exchange.Management.Recipi

Ā  entTasks.AddDistributionGroupMember

Ā Ā Ā  + PSComputerNameĀ Ā Ā Ā Ā Ā Ā  : xxx

Ā 

OR

Ā 

-Ā Ā Ā Ā Ā  The recipient "Z Yā€ is already a member of the group "xxx".

Ā 

How is that possible to add contacts per their email addresses?

Ā 

Kind regards,

Dayrak

Ā 

--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To post to this group, send email to ntpowe...@googlegroups.com.
Visit this group at https://groups.google.com/group/ntpowershell.
To view this discussion on the web visit https://groups.google.com/d/msgid/ntpowershell/SYBPR01MB319376844BFD413C4FD43E34E0740%40SYBPR01MB3193.ausprd01.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "ntpowershell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ntpowershell...@googlegroups.com.
To post to this group, send email to ntpowe...@googlegroups.com.
Visit this group at https://groups.google.com/group/ntpowershell.


For more options, visit https://groups.google.com/d/optout.


Message protected by MailGuard: e-mail anti-virus, anti-spam and content filtering.
http://www.mailguard.com.au

Report this message as spam Ā 
Ā 

Reply all
Reply to author
Forward
0 new messages