Others

Retrieve All Microsoft 365 Guest Users and Export Them to CSV

Nimra MalikNimra Malik Nov 14, 2026 868 views

Question details

Retrieve the complete list of guest users in a Microsoft 365 tenant and export it to a CSV file.

Retrieve All Microsoft 365 Guest Users and Export Them to CSV
Product
Microsoft 365 and Microsoft Graph PowerShell
Device & OS
not provided
Scenario
An administrator needs to list and export all users whose UserType is Guest.
Observed behavior
The existing Azure AD PowerShell script returns only the first 1,000 guest users.
Before you start

Make sure you can sign in to the target tenant and obtain the Microsoft Graph User.Read.All permission; administrator consent may be required. Check that PowerShell can install modules and write to your chosen CSV location.

Solution 1Recommended

Use Microsoft Graph PowerShell to Export All Guest Users

Use the -All parameter to retrieve every result page and export guest-user properties to CSV.

Microsoft Graph PowerShell is the recommended replacement for the deprecated Azure AD PowerShell module. The -All parameter follows pagination automatically.

1
Install the Graph module

Open PowerShell and run: Install-Module Microsoft.Graph -Scope CurrentUser. Confirm the installation prompts if needed.

2
Connect to the tenant

Run Connect-MgGraph -Scopes "User.Read.All" and sign in to the target Microsoft 365 tenant. Grant consent if prompted and authorized to do so.

3
Retrieve and export guests

Run: Get-MgUser -Filter "userType eq 'Guest'" -All -Property Id,DisplayName,UserPrincipalName,Mail,UserType | Select-Object Id,DisplayName,UserPrincipalName,Mail,UserType | Export-Csv -Path ".\guest-users.csv" -NoTypeInformation -Encoding UTF8

4
Check the CSV

Open guest-users.csv from the current PowerShell working directory and verify the rows and columns. Run Get-Location in PowerShell to see the directory.

Use Microsoft Graph PowerShell to Export All Guest Users
Guest email fields can be empty: The Mail property is not populated for every guest. UserPrincipalName and Id can help identify those accounts.
Free Microsoft Office alternative

Review Your Guest-User CSV in WPS Spreadsheet

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open your exported CSV to review and organize the results, or work with Excel files for an easy transition. WPS does not retrieve users from your Microsoft 365 tenant.

Open and review guest-user CSV exportsCompatible with Microsoft Excel XLS and XLSX filesFamiliar spreadsheet interface for a seamless transitionFree and lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my script return only 1,000 guest users?

The script may be using a result limit or not following additional result pages. With Get-MgUser, add -All to retrieve all pages.

What permission do I need to list guest users?

Connect with Connect-MgGraph -Scopes "User.Read.All". Your organization may require an administrator to consent to that permission.

Where is the exported CSV saved?

The path .\guest-users.csv saves the file in the current PowerShell working directory. Run Get-Location to find it, or specify another writable path in Export-Csv.

Can I open the exported list in a spreadsheet?

Yes. Open guest-users.csv in WPS Spreadsheet or Microsoft Excel to review the exported columns. The spreadsheet does not update the tenant directory.