Forum Discussion

YoyoD's avatar
YoyoD
Copper Contributor
Nov 09, 2023

Issue with Get-SPOExternalUser powershell command

Hi,

 

I'm trying to get a list of all external users that can access our company sharepoint online.

I found several scripts on the net using Get-SPOExternalUser command.

It is also explained in documentation that this command can only return 50 users maximum and that you have to loop to get all users (by blocks of 50 users).

I did try several unsuccescommands and finally found what seems to me as a critical bug.

 

If I run Get-SPOExternalUser -Position 0 -PageSize 50, I get a list of 50 users (all with name beginning with "a", meaning we have much more than 50 users). It seems correct.

 

Now if I run : Get-SPOExternalUser -Position 1 -PageSize 50

I get following error

Get-SPOExternalUser : If position is greater than zero, it must be less than the number of external users that match the search criteria
Parameter name: position
Au caractère Ligne:1 : 1
+ Get-SPOExternalUser -Position 1 -PageSize 50
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [Get-SPOExternalUser], ServerException
+ FullyQualifiedErrorId : If position is greater than zero, it must be less than the number of external users that match the search criteria
Parameter name: position,Microsoft.Online.SharePoint.PowerShell.GetSPOExternalUser

 

As a consequence, and since the only way to list all users with blocks of 50 users max, is to use the -position parameter, I can not succeed.

 

If anyone could confirm to me that they reproduce this issue, and that they also understand it as a bug, that would be great.

 

Thanks.

 

Resources