Remove "Everyone except external" from [Site Name] Members using PowerShell

Occasional Contributor

Hello there,


We are using SharePoint Online and are looking for a way to programmatically move the "Everyone except external users" Group from the Site Members group to a newly created Contributors group.


I have found a way to remove specific users from the Members group in the following command:

Remove-SPOUser -LoginName "user login name" -Site $Site -Group "Site Name Members"

However, when I list the Members' members, I am shown that "Everyone except external users" is listed as spo-grid-all-users/[guid here]. And then when I try and 

Remove-SPOUser -LoginName "spo-grid-all-users/guid" ...

I am presented with "The user does not exist or is not unique."

We do know how to do this from GUI, but how do we remove the "Everyone except external users" from the Site Members group with PowerShell and then add them the new group we created with Contributor permissions.


Thank you,


1 Reply

@jameshickey1140 Try to run Get-PnpGroupMember and you will see that Everyone except externaluser will have login name as c:0-.f|rolemanager|spo-grid-all-users/guid.

Try to remove using full log in name : Remove-PnPUserFromGroup -LoginName 'c:0-.f|rolemanager|spo-grid-all-users/guid