Discover our new product to help you understand usage and control costs in Azure. Explore Overcast.


Use SharePoint Online Powershell to Manage External Users

Jimmy De Santis
Use SharePoint Online Powershell to Manage External Users

Let’s face it, sharing content with outside users, clients, customers or vendors is often an important part of business. After all, the information needs to get around so everyone's up to speed. As this has to do with external users, it's important to be a little cautious since these people are not part of the company.

The Tricky Task of Managing External Users

There are different ways to share content externally depending on what's being shared (Site or content). It's important to keep a record of who this information is shared with. Let’s keep in mind that the external user will be granted the same level of permissions as the internal user that shared the content, so they can potentially copy, remove, add content and more.

The SharePoint Online Management Shell lets you fetch this information and ensure that things are as desired. My goal is to show you how to keep track and manage external users & sharings using the new commandlets as well as give you a look into what Sharegate has to offer on this side as well.

For instance, here's how you can retrieve the external users for a given site collection (it's important to have global tenant admin rights prior to running these queries):

First step:

Second Step:

It's also possible to use parameters to set restrictions on the search scope. For example, user name, number of users and the position in the index can all be set as arguments to the command. This is useful to run a quick query on a specific part of your environment.

Pair Sharegate with SharePoint Online PowerShell to Manage External Users

Another great way to gather this information is using Sharegate. The management module offers an easy access to an external users report. Please note that this query will return all users, not 50 at a time.

SharePoint Management Reports

The search is customizable with additional conditions and columns that you can select to be displayed in the report. Also, as with the command above, you can customize the scope to your liking (one of multiple site collections, check if orphaned etc.)

Search criteria to manage external users

Here's a look at the resulting report.

external users report results

As you can see both options will let you gather the external users and even allow you to set conditions. It really boils down to how comfortable you are with PowerShell.

The SharePoint Online PowerShell approach could be used in conjunction with an export to a CSV file if you need to see all the information in one location. Sharegate on the other hand will give you access to both an in-app report and an Excel spreadsheet if needed.

Having the external user information is great but being able to get rid the ones you don’t need is even better! Here's the PowerShell command that will allow you to do just that. Please note that this will delete the external user’s access completely so he'll no longer be able to sign in nor access any content.

You're now all set to continue using external Sharing with a renewed peace of mind. Please, let me know if you need a hand with your PowerShell script or your Sharegate reports, I'll gladly give you a hand. Finally, if you have other queries or actions you would like to discuss, feel free to do so below!

How often do you use SharePoint Online PowerShell commands?

Hey, got another minute?

Learn more about external sharing and benefit from the full potential of your Office 365.

The Ultimate Office 365 migration checklist