Report On External Users In SharePoint Online

In this post, I am going to introduce you all to a small PowerShell script, which will help you in getting the list of all the external users in your SharePoint Online tenant. Unlike Get-SPOExternalUser PowerShell command, this will display the list of all the sites in SharePoint Online, the external sharing status of those sites as well as with whom the sites are shared externally. This can be used by Office6 365 global admins or SharePoint Online admins to get a report of external sharing/users in their tenant.
Sharepoint

Let’s take a look at the script now.

Step1

Run this command in SharePoint online management shell to connect to your tenant.

Connect-SPOService -Url https://office365admin123-admin.sharepoint.com-credential $credentials

Step 2

Once done with the first command, run the command mentioned below to get the report.

  1. $i = 0  
  2. ForEach($site in Get - SPOSite)  
  3. {  
  4.     $i++  
  5.     Write - Host "*********"  
  6.     Write - Host "Site number: "  
  7.     $i  
  8.     $site.Url  
  9.     $site.Owner  
  10.     $site.SharingCapability  
  11.     Get - SPOExternalUser - SiteUrl $site.Url  
  12. }  

This is how the result of this script will look. Check the image given below.

Sharepoint

I hope, this helps you to get the report, which might be once in a week or a month. Thanks for reading this post. Happy SharePointing.

Ebook Download
View all
Learn
View all