
[SPO] Get a list of all external users in SPO
This is a script that will list all the external users on your SharePoint Online environment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Import MS Online PowerShell Module Import-Module MSOnline # Providing access credentials $credentials=Get-Credential # Connecting to SharePoint Online Connect-SPOService -Url https://tenant-admin.sharepoint.com -credential $credentials # Start count $i = 0 # Looping through each SPOSite and getting the external users ForEach ($site in Get-SPOSite) { $i++ Write-Host "======================================================" Write-Host “Site number: ” $i $site.Url $site.Owner $site.SharingCapability Get-SPOExternalUser -SiteUrl $site.Url } |
The results will look something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
====================================================== Site number: 1 https://tenant.sharepoint.com/sites/test1 andrei@mytenant.com Disabled ====================================================== Site number: 2 https://tenant.sharepoint.com/Sites/eDiscoveryCenter andrei@mytenant.com Disabled ====================================================== Site number: 3 https://tenant.sharepoint.com/sites/CompliancePolicyCenter Disabled ====================================================== Site number: 4 https://tenant.sharepoint.com/portals/hub Disabled ====================================================== Site number: 5 https://tenant-my.sharepoint.com/ ExternalUserAndGuestSharing Email : myusertest1@tenant.ro DisplayName : Test User UniqueId : 10134DEE9A5DAADE AcceptedAs : myusertest1@tenant.ro WhenCreated : 10/15/2016 8:01:24 PM InvitedBy : ====================================================== Site number: 6 https://tenant.sharepoint.com/sites/contentTypeHub Disabled ====================================================== Site number: 7 https://tenant.sharepoint.com/sites/test31 ExistingExternalUserSharingOnly ====================================================== Site number: 8 https://tenant.sharepoint.com/sites/SPS andrei@mytenant.com Disabled ====================================================== Site number: 9 https://tenant.sharepoint.com/search ExternalUserAndGuestSharing ====================================================== Site number: 10 https://tenant.sharepoint.com/sites/test ExistingExternalUserSharingOnly ====================================================== Site number: 11 https://tenant.sharepoint.com/portals/SPS2016 Disabled ====================================================== Site number: 12 https://tenant.sharepoint.com/ ExternalUserAndGuestSharing ====================================================== Site number: 13 https://tenant.sharepoint.com/sites/tenant ExistingExternalUserSharingOnly ====================================================== Site number: 14 https://tenant.sharepoint.com/portals/community Disabled ====================================================== Site number: 15 https://tenant.sharepoint.com/portals/WinServer2016 Disabled ====================================================== Site number: 16 https://tenant.sharepoint.com/portals/testing123 Disabled |