0

Can anyone provide SharePoint online power-shell to extract list of site collection admins along with all site URL's for entire tenant?

1 Answer 1

3

You can run the following powershell (this will return all the primary admins of all site collections).

$sites = Get-SPOSite -Limit All
$sites | select url,owner

To get all admins Please try below script.

$spousers = Get-SPOUser -Site https://example.sharepoint.com/sites/training

$spousers | select LoginName, IsSiteAdmin

Read more here: link

Try this one. I dont have any tenant so i cant test it.

 $sites = Get-SPOSite -Limit All
foreach ($site in $sites) {
Get-SPOUser -Site $site.Url | FT LoginName, IsSiteAdmin -AutoSize
}
7
  • Thanks for the info, but I need all the administrator not only primary , we need secondary admins too. It will be helpful if you can provide script that provides complete list of admins. Commented Mar 6, 2017 at 16:06
  • Check updated answer
    – Waqas Sarwar MVP
    Commented Mar 6, 2017 at 16:07
  • Can we tweek it to get it for all sites instead of single site? Commented Mar 6, 2017 at 16:09
  • Yes you can, it is starting point...
    – Waqas Sarwar MVP
    Commented Mar 6, 2017 at 16:09
  • Sorry to bug you again. I am not good at powershell, can you able to provide it to me with looping to all sites? Commented Mar 6, 2017 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.