Forum Discussion

kmktnn's avatar
kmktnn
Iron Contributor
Feb 07, 2020

External users per site collections

We need to find all the site collections one external user has access to.
 
I tried the script with Get-SPOExternalUser to find all external users. Plenty of advice in blogs, great!
https://vladtalkstech.com/2018/03/create-a-report-of-sharepoint-online-external-users-with-powershell.html
http://www.balestra.be/2018/04/list-all-external-users-on-all-sharepoint-online-sites-in-powershell.html

However, I would need to be a site collection administrator of all the site collections. And it sounds extreme.
 
How did you solve it in your tenant? Do you have a user who is an admin of all the site collections?
 
Should I grant access as a site coll admin (Set-SPOUser -site $SiteCollURL -LoginName $SiteCollectionAdmin -IsSiteCollectionAdmin $True) before checking Get-SPOExternalUser and then remove the user?
 
Also, there is another pitfall. When the permissions of an external user are deleted from a site collection, we can still see it with Get-SPOExternalUser because the user stays in the SharePoint UserInfo List.
 
Any advice is welcomed 🙂

1 Reply

  • That's beause to execute a PS Script agains a site you need to be at least Site Collection Admin If I'm correct