Who's Online
6 visitors online now
1 guests, 5 bots, 0 members
Support my Sponsor
  • An error has occurred, which probably means the feed is down. Try again later.

Check permission of a user on all site collections in SharePoint Online

Also explained in the youtube video : https://youtu.be/ti9X3UNdoMY

Connect to SharePoint Online

Connect-SPOService -Url “https://yourtenant-admin.sharepoint.com” -Credential (Get-Credential)

Get all site collections

$allSiteCollections = Get-SPOSite

Loop through each site collection

foreach ($site in $allSiteCollections) {
$siteUrl = $site.Url
Write-Host “Site Collection: $siteUrl”

# Validate user permissions
$userEmail = "[email protected]"  # Replace with the user's email address
$userPermissions = Get-SPOUser -Site $siteUrl | Where-Object { $_.LoginName -eq $userEmail }

if ($userPermissions.Count -gt 0) {
    Write-Host "User has permissions on this site collection."
} else {
    Write-Host "User does not have permissions on this site collection."
}

}

Comments are closed.