We will all get in to situation to know the list of external users that we have in our SharePoint Online tenant. Usually , Get-spoexternaluser is the command that is used to fetch the list of external users. But this has a hard limit of fetching max of 1000 users.
Reason
The Get-spoexternaluser uses .Net DirectorySearcher class to get the Guest users from the Tenant. The reason that it can get only 1000 users is due to the fact the limit about the Directory Searcher is 1000.
Options
If your tenant has large number users ( >1000) the list of external users can be fetched using the following method
Get-MsolUser -All | ? {$_.usertype -eq "Guest"}
For getting the list of unlicensed users please use the below command:
Get-MsolUser -UnlicensedUsersOnly -All | ? {$_.usertype -eq "Guest"}
Additional Information can be fetched using the Examples in the KB
Leave a comment