Forum Discussion

reenaroycs's avatar
reenaroycs
Brass Contributor
Dec 24, 2018

to know who have SCA access on tenant

Hello Team,

 

Please update us is there any way to get the report or name of the users who have permission of site collection administration on SharePoint online tenant. 

 Is there any script for power shell because its very difficult to find name by going each and every site collection on tenant.

 

Regards,

Reena Roy

 

  

4 Replies

  • Try this script and To run this you must be a SharePoint Online global administrator and a site collection administrator

    $Creds = Get-Credential
    
      $site = ‘https://tenant-admin.sharepoint.com’
    
    Connect-SPOService -Url $site -Credential $Creds
    
    $AllSites= Get-SPOSite -Limit All
    
    $users = @();
    foreach ($Allsite in $AllSites)
    {
    
    $AllUsers = Get-SPOUser -Site $AllSite.Url -Limit all | select DisplayName, LoginName,IsSiteAdmin
    $users+=$AllUsers
    $AllUsers = $null
    #Write-Host $AllSite.Url" completed"
    
    }
    $users | Export-Csv -Path "C:\Users\Desktop\allusers.csv" -NoTypeInformation -Force
    
    $Data = Import-Csv "C:\Users\Desktop\allusers.csv"
    
    foreach($aUser in $Data)
    
    {
    
      if($aUser.IsSiteAdmin -eq “True”)
    
      {
    
        Write-Host $aUser.DisplayName $aUser.LoginName
    
      }
      }

     Hope this helps 

    • reenaroycs's avatar
      reenaroycs
      Brass Contributor
      Thanks Ganeshan, and sorry for the late response. I will run this script if i can get the report and will update you. :)