Microsoft 365 Guest User Report
Use at your own risk. Test in a non-production environment first.
Connect-MgGraph -Scopes "User.Read.All","Directory.Read.All"
Get-MgUser -Filter "userType eq 'Guest'" -All |
Select-Object DisplayName, UserPrincipalName, AccountEnabled, CreatedDateTime |
Export-Csv .\m365-guest-users.csv -NoTypeInformation
Review guests before tenant-to-tenant, SharePoint, Teams, and external sharing migrations.
