Updated 4 days ago

Find Teams with Guests and External Users in Microsoft Teams

by Praba

4 min read

No Comments

Microsoft Teams’ guest access feature is a game-changer for cross-organizational collaboration, allowing external users to participate in your organization’s teams. While external collaboration in teams enhances productivity, it also requires regular monitoring to ensure sensitive information is not compromised.

Knowing teams having external user access is vital for maintaining security and enforcing organizational policies. By identifying these teams, administrators can review guest access permissions and implement stricter controls to manage external access securely in MS Teams.

This blog will explore various methods to find teams with guests, offering manual and automated solutions to make the process seamless and efficient.

How to Identify Teams with Guests and External Users in Microsoft 365?

Unfortunately, Microsoft 365 does not offer a direct way to identify all teams with guest members. Below are the manual and automated approaches to solve this problem.

Finding Teams with Guest Users in Microsoft Teams Admin Center

  1. Sign in to the Microsoft Teams admin center.
  2. Navigate to Teams –> Manage Teams.
  3. Select a team and view its Members list to identify users marked as “Guest.”

This process needs to be repeated for each team, making it impractical for organizations with many teams.

Get Teams Containing Guest Users Using PowerShell

PowerShell offers a faster way to locate guest users in specific teams. The Get-TeamUser cmdlet retrieves members of a specific team and filters for guest users.

However, running this cmdlet for each team is still manual and time-consuming, especially in larger environments. Additionally, organizing results into a clear report can be complex.

Solution – To simplify this task, we’ve developed a custom PowerShell script designed to streamline the process. This script scans all teams in the organization to identify those containing internal guests and external members. Additionally, it generates a detailed report that lists the teams along with the number of guests and external users in each.

Download Script: GetTeamsWithGuests.ps1

Script Highlights

  • The script exports 2 different reports:
    • Detailed report: Teams and their guest user details
    • Summary report: Teams and their guest users count
  • Automatically installs the Microsoft Teams PowerShell module (if not installed already) upon your confirmation.
  • Exports the report result to CSV.
  • The script can be executed with an MFA enabled account too.
  • It can be executed with certificate-based authentication (CBA) too.
  • The script is schedular-friendly.

Sample Output

Upon execution, the PowerShell script will export the following two reports.

Detailed report: Teams and their guest user details

The report will list all the teams containing guest/external users in the organization along with the following attributes:

  • Teams Name
  • Guest Name
  • Guest Mail

Get Teams with Guests in Microsoft 365

Summary report: Teams and their guest users count

This report will contain all the teams containing guest users and the guest users’ count along with the following attributes:

  • Team Name
  • Guest Count

Teams and their guest users count

Tip: After identifying teams with guest users, ensure secure collaboration by blocking essential security settings for external users.

Export Teams Collaborating with External Users – Script Execution Steps

  1. Download the script.
  2. Start the Windows PowerShell
  3. Select any of the methods provided to execute the script.

Method 1: You can run the script with MFA and non-MFA accounts.

This script generates two CSV files, listing teams with guests and external users along with the guests’ names, email addresses, and the number of guests per team.

It is also possible to export a list of teams a specific guest user is a member of using PowerShell.

Important Note: As we know, with Shared Channels in Microsoft Teams, you can invite external users to specific channels without adding them to the entire team. When running the script to get teams with guest users, it will display only the guests and external users added to the team itself. As a result, external users added to the shared channels won’t be included. To ensure you have a full view of all external users access to your Teams environment, it’s important to check the shared channel memberships as well.

Method 2: Execute the script by explicitly mentioning credentials.

The above method supports only non-MFA accounts. If the admin account has MFA, you need to disable MFA using CA policy to make this work.

Method 3: Execute the script using certificate-based authentication.

To use certificate-based authentication, you must register the app in Entra ID which helps you connect Microsoft Teams PowerShell.

Depending on your requirements, you can create a self-signed certificate.

Tip: We have also crafted a PS script to get a complete overview of Microsoft Teams, detailing all teams, channels, and their respective members and owners.

We hope that our PowerShell script will be helpful in finding teams having guest access within Microsoft Teams. Feel free to leave a comment if you encounter any issues or have suggestions for enhancements!

Share article