Hi @Machiel Korf | Korf KB ,
The error message suggests that the value of the Group parameter is null, which means that it is not being set or passed correctly in the script.
It is possible that the variable $SpoGroupVisitor
is not being set correctly or is null. You may need to check the value of this variable and ensure that it is being set to a valid SharePoint group before running the Add-SPOUser
cmdlet.
Alternatively, you may need to create a new SharePoint group and add users to it before running the Add-SPOUser
cmdlet.
For your reference:
Manage SharePoint users and groups with PowerShell
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.