SharePoint Online: PowerShell to Get External Sharing Settings

Requirement: Find all site collections with external sharing enabled (or disabled!)

PowerShell to Get External Sharing Configuration in SharePoint Online:
External sharing (or guest sharing) feature in SharePoint Online enables users to share documents and content outside the organization with people who are not members of your organization such as external vendors, customers, consultants, etc.

SharePoint Online: PowerShell to List External Sharing
While External sharing settings at tenant level can be configured using links provided in the bottom of this article, We can check external sharing settings for all site collections level using this PowerShell script in SharePoint Online Management Shell:
#Config Variables
$AdminSiteURL= "https://crescent-admin.sharepoint.com"

#Connect to SharePoint Online services
Connect-SPOService -url $AdminSiteURL -Credential (Get-Credential)

#Get External Sharing Settings for all sites
Get-SPOSite | Select-object url,sharingcapability

Similarly, we can get all Site collections where external sharing is enabled, as:
#Get All Site Collections with External Sharing Enabled
$Sites = Get-SPOSite -IncludePersonalSite $False | where {$_.SharingCapability -ne "Disabled"} 

#Get URL of each site
Foreach ($Site in $Sites)
{
   Write-Host $Site.Url
}

and the settings denotes these things:
  1. ExistingExternalUserSharingOnly - Allow sharing only with external users that already exist in organisation's directory (Default Setting)
  2. Disabled - external user sharing (share by email) and guest link sharing - both disabled
  3. ExternalUserSharingOnly - external user sharing (share by email) enabled, but guest link sharing disabled
  4. ExternalUserAndGuestSharing - external user sharing (share by email) and guest link sharing both enabled

Related Posts:
SharePoint Online: PowerShell to Get External Sharing Settings SharePoint Online: PowerShell to Get External Sharing Settings Reviewed by Salaudeen Rajack on November 21, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.