Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Hello Bryce Knezovich,
From your post, in general, when using New-DistributionGroup command, I would suggest you may use the parameters this command provided, like -Name, -Alias, -Type, otherwise PowerShell will not recognize. You may also use ForEach-Object than foreach. It is also recommended to modify the column headers in CSV file so they can be called by PowerShell properly.
If you’d like to create distribution group for each entry in CSV file, you may refer to:
Import-CSV “C:\Users\Administrator\Desktop\parents.csv” | Foreach-Object { New-DistributionGroup –Name $_.Name –Alias $_.Alias –Type $_.Type }
Or if you want to add these entries to an existing distribution group, you may use:
Import-CSV "C:\Users\Administrator\Desktop\parents.csv" | Foreach-Object { Add-DistributionGroupMember -Identity "T estDL2" -Member $_.Member }
If it isn’t an existing group, you may create it first, then add members:
New-DistributionGroup –Name “TestDL2” –Alias “testdl2”
Import-CSV "C:\Users\Administrator\Desktop\parents.csv" | Foreach-Object { Add-DistributionGroupMember -Identity "TestDL2" -Member $_.Member }
Here are some articles for your reference:
Best Regards,
Anna