Forum Discussion
Trying to add a single user to multiple 365 groups
$groups = get-unifiedgroup -filter {(DisplayName -like '*Similar Groups*') -and (DisplayName -ne 'Specific Group I don't want to add')} | select Name
Foreach ($group in $groups) { add-unifiedgrouplinks -identity $group -linktype Members -Links singleuser@email.com -whatif }
Getting error Cannot process argument transformation on parameter 'Identity'. Cannot convert the 365 group value of type "Deserialized.Selected.System.Management.Automation.PSCustomObject" to type "Microsoft.Exchange.Configuration.Tasks.UnifiedGroupIDParameter".
That's because you are passing the entire object. Try this:
Foreach ($group in $groups) { add-unifiedgrouplinks -identity $group.Name -linktype Members -Links singleuser@email.com -whatif }
That's because you are passing the entire object. Try this:
Foreach ($group in $groups) { add-unifiedgrouplinks -identity $group.Name -linktype Members -Links singleuser@email.com -whatif }
- Graham YoungCopper Contributor
That did it, thank you!