Add-PnPGroupMember won't map a user

New Contributor

With the following command I will entitle our users to a specfic site:

Connect-PnPOnline -Url -Credentials $userCredential2
$groupMember = Get-PnPGroup -AssociatedMemberGroup
$gruppennameM = $groupMember.Title
$groupid = $groupMember.Id
Add-PnPGroupMember -LoginName -Group $groupid


After sending command above I get the following error:
Add-PnPGroupMember : Method not found: "Int32 System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`1)".


The command is full correct, the ID of the group is correct and the user is correct.
Why does the command not work for me ?


1 Reply

I had the same issue when running my script from VS Code, no problem in PowerShell command prompt.