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.
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.
- $i = 0
- ForEach($site in Get - SPOSite)
- {
- $i++
- Write - Host "*********"
- Write - Host "Site number: "
- $i
- $site.Url
- $site.Owner
- $site.SharingCapability
- Get - SPOExternalUser - SiteUrl $site.Url
- }
This is how the result of this script will look. Check the image given below.
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.