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
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
}
-
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
-
-
Can we tweek it to get it for all sites instead of single site? 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