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

%3CLINGO-SUB%20id%3D%22lingo-sub-1115513%22%20slang%3D%22en-US%22%3EGet%20details%20of%20all%20external%20users%20from%20the%20complete%20SharePoint%20online%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1115513%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20export%26nbsp%3Bdetails%20of%20all%20external%20users%20from%20the%20complete%20SharePoint%20online%20tenant.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20the%20out%20of%20the%20box%20command%20just%20generates%2050%20users%2C%20I%20am%20trying%20the%20following%20command%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20%7B%3CBR%20%2F%3EFor%20(%24x%3D0%3B%3B%24x%2B%3D50)%20%7B%3CBR%20%2F%3E%24ExternalUsers%20%2B%3D%20Get-SPOExternalUser%20-PageSize%2050%20-Position%20%24x%20-ErrorAction%20Stop%20%7C%20Export-csv%20C%3A%5Ctemp%5CExternalusers.csv%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3ECatch%20%7B%7D%3CBR%20%2F%3E%24ExternalUsers%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehowever%20I%20want%20to%20export%20it%20to%20csv%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20assist%20in%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1115513%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eexternal%20user%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eexternal%20user%20access%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFiles%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESites%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1119607%22%20slang%3D%22en-US%22%3ERe%3A%20Get%20details%20of%20all%20external%20users%20from%20the%20complete%20SharePoint%20online%20tenant%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1119607%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F163419%22%20target%3D%22_blank%22%3E%40Test%20SharePoint%3C%2FA%3E%26nbsp%3B%20Perhaps%20this%20solution%20might%20help%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fvladtalkstech.com%2F2018%2F03%2Fcreate-a-report-of-sharepoint-online-external-users-with-powershell.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fvladtalkstech.com%2F2018%2F03%2Fcreate-a-report-of-sharepoint-online-external-users-with-powershell.html%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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