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


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
|improve this answer|||||
  • 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. – raj Mar 6 '17 at 16:06
  • Check updated answer – Waqas Sarwar MVP Mar 6 '17 at 16:07
  • Can we tweek it to get it for all sites instead of single site? – raj Mar 6 '17 at 16:09
  • Yes you can, it is starting point... – Waqas Sarwar MVP Mar 6 '17 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? – raj Mar 6 '17 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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