Created
April 8, 2018 07:17
-
-
Save mrik23/1bdbee1fa221dd80949ff6495bfa0142 to your computer and use it in GitHub Desktop.
PowerShell script to retrieve external users that have been added via modern sharing experience on files and folders (with verification code to email). These users are not retrieved with Get-SPOExternalUser and not present in Azure AD.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Script to retrieve external users that have been added via modern sharing experience on files and folders (with verification code to email). | |
These users are not retrieved with Get-SPOExternalUser cmdlet and not added as guest users in Azure AD. | |
Requires: SharePoint Online Management Shell > https://www.microsoft.com/en-us/download/details.aspx?id=35588 | |
#> | |
Connect-SPOService -Url https://<tenantName>-admin.sharepoint.com | |
Get-SPOSite -Limit All | ForEach-Object { | |
if (($_.SharingCapability -ne "Disabled") -and ($_.SharingCapability -ne "ExistingExternalUserSharingOnly")) { | |
$url = $_.Url | |
Get-SPOUser -Site $url -Limit All | Where-Object -Property LoginName -match guest | Select-Object -Property @{n="Url"; e={$url}}, DisplayName, LoginName | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment