Retrieve All Microsoft 365 Guest Users and Export Them to CSV
Question details
Retrieve the complete list of guest users in a Microsoft 365 tenant and export it to a CSV file.

- 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.
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.
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.
Open PowerShell and run: Install-Module Microsoft.Graph -Scope CurrentUser. Confirm the installation prompts if needed.
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.
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
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.

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.

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.




