How to remove guests from Microsoft 365 Teams in one click

How to remove guests from Microsoft 365 Teams in one click

Microsoft 365 Teams are not just conversation hubs, they act as storage spaces for sharing information among people with common goals and projects. Often, these goals and projects are temporary and involve guests that are invited to join the Team. Microsoft Teams guests can become numerous so at some point in your IT life, you will need to keep track of the number of guests you have and remove them from teams when they no longer have any related business or interest in the Team. However, depending on the number of Teams and guests, removing guests from Teams can be a long and arduous process.

You can do this using the Microsoft 365 portal, but it’s a tedious process. You have to click on each Microsoft teams guest to see their team membership and then delete them. If you have a lot of guests, it’s not the most efficient way to do things. Most IT admins will consider using a PowerShell script to accomplish this task, but using any script is risky and, in this case, it can be complicated. Let’s look at and compare two methods: one using PowerShell,  and the other using a PowerShell alternative, such as sapio365, to remove guests from Microsoft 365 Teams.

Option 1 – PowerShell to remove guests from Microsoft 365 Teams

If you enjoy writing scripts, you could put something together with PowerShell cmdlets that let you identify Microsoft Teams guest users and retrieve their Teams memberships, and then another to remove the guest from each Team.

By using MSOnline PowerShell, you can use this cmdlet to retrieve all guests:
Get-MsolUser | Where {$_.UserType -eq ‘Guest’}

Then use this Microsoft 365 Teams PowerShell cmdlet to get a list of Teams for each guest:
Get-Team -User guestname_otherdomain.com#EXT#@yourdomain.com

Finally, you can use the Remove-TeamUser cmdlet to remove a guest, member, or owner from a Team.

You will also need to determine if any of those Microsoft 365 Teams have dynamic membership rules in place or you will get an error if try to remove them directly from this type of Team.

If this sounds complicated, that’s because it is!

Save yourself the headache and the risk. Keep reading to learn how quick and easy it is to identify guests, get their Microsoft 365 Teams and remove them from those Teams with less than five clicks.

Option 2 – sapio365 to remove guests from Microsoft 365 Teams

Use sapio365 to see all users, members and guests and their information at once.

You can then isolate guests by filtering out members. It’s easy to select them all.

Retrieve the list of groups that each guest belongs to. If they are part of any other group type, you will see them listed here.

Select them to remove them from the Teams.

To make sure there are no errors, you can preview their removal from all groups and Teams before clicking to save.

Conclusion

So, in summary, IT admins have three options to consider when they need to remove guests from Microsoft 365 Teams. The first is to use the Microsoft 365 portal and waste a lot of time. The second is to write or find a PowerShell script and hope that it does what it’s supposed to do without missing any guests. The last choice is to use sapio365 to accomplish this task accurately and safely in much less time with a lot less effort. To learn more about how one client did exactly that, read our customer story here.