Nov 09 2023 01:01 PM
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.
Jan 31 2024 12:10 AM
@YoyoD I have the same problem. It worked before, but I now get the same error message as you.
Jan 31 2024 05:29 AM
Refer below PowerShell scripts to get the external users in SharePoint:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Jan 31 2024 05:42 AM
I ended up filtering for a specific user instead of browsing.
Get-SPOExternalUser -filter "UPN"