Forum Discussion
How to create O365 Groups in Powershell from a csv file
- Oct 29, 2018
The reason for the failure is PowerShell treating the value in that column as string, and not a list. You should be able to do it like this:
Add-UnifiedGroupLinks groupname -LinkType Member -Links $_.Members.Split(",")
You can adapt the example for the New-UnifiedGroup cmdlets as well, it's simply easier to test with the Add-UnifiedGroupLinks one.
The reason for the failure is PowerShell treating the value in that column as string, and not a list. You should be able to do it like this:
Add-UnifiedGroupLinks groupname -LinkType Member -Links $_.Members.Split(",")
You can adapt the example for the New-UnifiedGroup cmdlets as well, it's simply easier to test with the Add-UnifiedGroupLinks one.
- Vincent ORTOLLANDOct 31, 2018Copper Contributor
Hello,
It works perfectly.
I tried to adapt my own script and with just a -split when declaring my variables, it works as well.
Thank you very much, you helped me greatly.
Vincent
- BeuferdDec 27, 2020Copper Contributor
Vincent ORTOLLAND
Can you show the finished script?
I don't know how to make the adjustment to your original script.- Stijn_van_AkenDec 29, 2021Copper Contributor
Hi Beuferd,
you can still use the existing script, only make sure this is added to the $members variable:
.split("<splitting option used c.q. ;>") .
In my case this would end up with the following command:
New-UnifiedGroup -DisplayName $Name -EmailAddresses $Mail -ManagedBy $Owner -Members $Members.split(";") -AccessType Private -Language en-EN -RequireSenderAuthenticationEnabled $false -SubscriptionEnabled -AutoSubscribeNewMembers
}
You can use this as well for the owners variable.
Good luck.
- Mohsin AbbasJan 04, 2019Copper Contributor
Did the SPO sites for these groups get provisioned? I'm bulk creating groups using New-UnifiedGroup but finding that the SPO site for the group does not get provisioned when the group is created using New-UnifiedGroup command.