Forum Discussion

Graham Young's avatar
Graham Young
Copper Contributor
Nov 02, 2018

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-unifiedgrou...
  • VasilMichev's avatar
    Nov 02, 2018

    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 }

Resources