Hi @Glenn Maxwell,
Based on your description, you could use this command to add/remove user via CSV:
For add:
Import-CSV "C:\members.csv" | ForEach-Object {Add-UnifiedGroupLinks –Identity "XXX" –LinkType Members –Links $_.member}
For remove:
Import-CSV "C:\members.csv" | ForEach-Object {Remove-UnifiedGroupLinks –Identity "XXX" –Links $.member –LinkType Members -Confirm:$false Write-Host "The user" $.member "removed"}
Here is the sample CSV:
However, I suggest you can do it step by step since you just need to tack action on a small number of users.
Note: You can’t add an Owner straight away to group, first you will have to make it a member of the group and then you can change the role to owner.
So we add [@contoso.com] & [@contoso.com] and [@contoso.com] & [@contoso.com] as the member first, run this command:
Add-UnifiedGroupLinks -Identity "XXX" -LinkType Members -Links [@consoto.com], [@consoto.com], [@consoto.com], [@consoto.com]
Then change [@contoso.com] & [@contoso.com] the role to Owner, run this command:
Add-UnifiedGroupLinks -Identity "XXX" -LinkType Owners -Links [@consoto.com], [@consoto.com]
To remove user1 & user2, run this command:
Remove-UnifiedGroupLinks -Identity "XXX" -LinkType Members -Links [@consoto.com], [@consoto.com]
For more information you can refer to the documents below:
Add-UnifiedGroupLinks (ExchangePowerShell) | Microsoft Learn
Remove-UnifiedGroupLinks (ExchangePowerShell) | Microsoft Learn