Oct 12 2019 06:59 AM
Oct 12 2019 06:59 AM
I am trying to add multiple users in a distribution Group.
All users are in cloud.
I have a CSV which has the following columns :
DisplayName, Alias, PrimarySmtpAddress
I am trying the following script:
$Userslist = Import-CSV c:\users\user\ab.csv
ForEach ($User in $Userslist)
Add-DistributionGroupMember -Identity "Office" -Member $User.PrimarySmtpAddress
I am getting the following error:
Cannot validate argument on parameter 'Member'. The argument is null. Provide a valid value for the argument, and then try running the command again.
+ CategoryInfo : InvalidData: (:) [Add-DistributionGroupMember], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-DistributionGroupMember
+ PSComputerName : outlook.office365.com
any help would be appreciated
Oct 12 2019 07:14 AM
@Test SharePointSomething breaks during import. "Cannot validate argument on parameter 'Member'. The argument is null." Null means that it couldn't parse the csv, otherwise it would be an empty string.
Have you confirmed that the import actually works?
$Userslist = Import-CSV c:\users\user\ab.csv $Userlist $Userlist
Oct 12 2019 07:35 AM
@Daniel Niccoli : thanks for your reply. I tried the above command and get this:
Cannot index into a null array.
At line:1 char:1
+ CategoryInfo : InvalidOperation: (:) , RuntimeException
+ FullyQualifiedErrorId : NullArray
Oct 12 2019 08:55 AMSolution
@Test SharePointThen either your csv file is malformed, or you need to modify the Import-Csv parameters.
Oct 15 2019 10:42 AM
@Daniel Niccoli : thank you.. i created a new csv and that worked.
Jan 18 2021 10:59 AM
Some info on exactly what you did would be helpful. I've wasted over an hour on this and I'm ready to just add the 114 people via the web interface, given there is no definitive way to validate any error message in Powershell. @Test SharePoint
Feb 02 2021 03:42 AM
Mar 16 2021 01:32 PM
Not really, I have also created csv file from Excel using their export function and it does not work.
What was the error in the creation of the csv file - or more appropriately what was the error if one follows the instructions as written in various postings, ie:
Mar 16 2021 02:46 PM
Saved Excel file in all three available csv formats: comma-delimited, Mac and DOS. All three fails with the same error but different character location (Mac format file the outlier).
I have also used Notepad to create a generic csv file with the same outcome.
Mar 16 2021 03:20 PM