Get details of all external users from the complete SharePoint online tenant

Brass Contributor

I am trying to export details of all external users from the complete SharePoint online tenant.

 

Since the out of the box command just generates 50 users, I am trying the following command:

 

Try {
For ($x=0;;$x+=50) {
$ExternalUsers += Get-SPOExternalUser -PageSize 50 -Position $x -ErrorAction Stop | Export-csv C:\temp\Externalusers.csv
}
}
Catch {}
$ExternalUsers

 

 

however I want to export it to csv?

 

Can someone assist in this?

 

 

1 Reply