I need some help regarding PowerShell and SPO.

I want to have a report showing all groups an external user is a member of in a site collection. For internal users, this is simply done that way:

Get-SPOUser -Site *SiteCollection* -LoginName *UserName* | Select-Object -ExpandProperty Groups

But i cannot figure out how to get a similar result for external users.

Get-SPOUser is not working with external accounts as far as I can see, Get-SPOExternalUser is not capable of showing the Groups a user is in...

Thanks in advance!

1 Answer 1


In SharePoint Online, the user LoginName for the external user is formatted as "user_contoso.com#ext#@tenant.onmicrosoft.com".

For example: an external user with "[email protected]" email, his LoginName is "user_outlook.com#ext#@tenant.onmicrosoft.com.

Use the following commands to get groups:

Get-SPOUser -Site "https://tenant.sharepoint.com/Sites/<site>" -LoginName "user_domain.com#ext#@tenant.onmicrosoft.com" | Select-Object -ExpandProperty Groups
  • Perfect, this solves my issue! Did not expect to need that extended format...
    – SPO-Guy
    Commented Nov 22, 2018 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.