SharePoint Online: Grant Access to ‘Everyone’, ‘Everyone Except External Users’ Group using PowerShell

Requirement: Grant Access to “Everyone” and “Everyone Except External Users” groups in SharePoint Online.

How to Grant Access to Everyone or Everyone Except External Users Groups?

Prerequisites: Make sure You have Enabled “Everyone” and “Everyone Except External Users” claims in SharePoint Online before running these PowerShell scripts.

Granting access rights to either the “Everyone” or “Everyone except the external users” group is no different from adding any other users to SharePoint Online sites. Just navigate to the site, click on site permissions or select the relevant group and then pick these groups from the people picker and then Click on Share – you are done!

sharepoint online enable grant permission to everyone everyone except external users groups

You can also share the site with everyone group by directly adding them to the site with proper permission level,

PowerShell to Grant Permissions to Everyone or Everyone Except External Users Group

Grant access to “Everyone” in SharePoint Online using PowerShell

Let’s share the site with the “Everyone” group by adding them to the visitors group of the site using PowerShell.

#Parameters
$SiteURL = "https://crescentintranet.sharepoint.com/sites/marketing"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#"Everyone" Group's Login ID
$LoginName = "c:0(.s|true"

#Get the Members Group of the site
$VisitorsGroup = Get-PnPGroup -AssociatedVisitorGroup

#Add Everyone Except External users claim to Site Group
Add-PnPGroupMember -LoginName $LoginName -Identity $VisitorsGroup

PowerShell to Add “Everyone except external users” to SharePoint Online

Similarly, to grant permissions to “Everyone except external users” in SharePoint Online – Here is the PowerShell script.

#Parameters
$SiteURL = "https://crescentintranet.sharepoint.com/sites/marketing"

#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Get "Everyone Except External Users" Login ID
$LoginName = "c:0-.f|rolemanager|spo-grid-all-users/$(Get-PnPTenantID)"

#Get the Members Group of the site
$MembersGroup = Get-PnPGroup -AssociatedMemberGroup

#Add Everyone Except External users claim to Site Group
Add-PnPGroupMember -LoginName $LoginName -Identity $MembersGroup

The Syntax for “Everyone Except External Users” claim is bit tricky here.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply