Avatar of nav2567
nav2567Flag for United States of America

asked on 

Unable to bulk add members to a Distribution Group

Hello,

I have a CSV file c:\users.csv which has list of UPN.  The format looks like this:

UPN
user1@mydomain.com
user2@mydomain.com
.....

I am able to use the below command to add members to an Office 365 Group:
Import-CSV "C:\users.csv" | % { Add-UnifiedGroupLinks -Identity "Office 365 testgroup" -LinkType Member -Links $_.UPN  }

However, I am getting an error if I specify a Distribution Group I create in the O365 portal Exchange admin console.
"This operation couldnt be performed because object 'testgroup' couldn't be found on ......outlook.com.....

What is the main different between the two type of groups?  How do I fix the issue?

Thanks.
PowershellMicrosoft 365

Avatar of undefined
Last Comment
marcus
ASKER CERTIFIED SOLUTION
Avatar of Adam Brown
Adam Brown
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of nav2567
nav2567
Flag of United States of America image

ASKER

Thanks, Adam Brown....

I am trying import-csv "C:\users.csv" | foreach {add-distributiongroupmember -identity test -member $_.UPN} and I am still getting error - The operation couldn't be performed because 'TEST' matches multiple entries...

Test is a distribution group.  My users.csv file remains the same

UPN
user1@mydomain.com
user2@mydomain.com
.....

Please advise again.

Thanks.
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

The problem is with the group, not the members. Find a better identity for the group.
Get-DistributionGroup -Identity 'Test'

Open in new window

Avatar of nav2567
nav2567
Flag of United States of America image

ASKER

The distribution group was created in the Exchange Admin console - new>new distribution group.  

I tried Get-DistributionGroup -Identity 'Test'.   I am getting this:

The current operation is not supported on GroupMailbox.
    + CategoryInfo          : NotSpecified: (Test:String) [Get-DistributionGro
   up], RecipientTaskException
    + FullyQualifiedErrorId : [Server=DB9PR0197MB2882,RequestId=6d9e0886-6ec3-
   445a-99e1-75a856118ec2,TimeStamp=4/12/2017 10:13:36 AM] [FailureCategory=C
  mdlet-RecipientTaskException] 206B6623,Microsoft.Exchange.Management.Recip
 ientTasks.GetDistributionGroup
    + PSComputerName        : ps.outlook.com
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Something not quite right there by the looks of it, might need a bit of a look into whether or not that group is working.
see if this shows up:
Get-Recipient Test -RecipientTypeDetails GroupMailbox

Open in new window

for more info refer: https://social.technet.microsoft.com/Forums/lync/en-US/5e33627d-aaaa-43f6-a8a3-38c6d63ab4d0/cant-find-phantom-email-address-on-office-365-tenancy?forum=onlineservicesexchange
this could get you to the right direction
Avatar of marcus
marcus
Flag of Philippines image

Can you check what is the group type of the group you created. Go to Exchange Admin Center> Recipients> Groups. The group type should be "Distribution group" and not "Office 365 Group".
Powershell
Powershell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo