0

I'm trying to bulk move users from one group to another in a SharePoint online group. I ran this script:

enter image description here

And it moved only users that have O365 licenses. When it tried to move the other users, I got this error:

enter image description here

Am I only able to move users that have licensed accounts? Or is there something that I'm missing in the script? For what it's worth, I'm working inside of a GCC High tenant.

Any insight would be helpful!

1 Answer 1

0

If a user doesn't have an Exchange Online license, they won't have an Email address. This means that $User.Email will be blank. Try using $User.LoginName instead of $User.Email.

This would also mean you don't have to prepend i:0#.f|membership| to email to get $UserID. You can simply use Add-PnpGroupMember -LoginName $User.LoginName -Identity $DestinationGroupName

1
  • Awesome!! Thank you so much. I'll definitely remember that going forward when using other scripts. Commented Jul 12, 2023 at 22:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.