Export site owner details (From M365 group email address), Storage used details for all the site available in the tenant

tamilarasan l 41 Reputation points
2025-05-22T08:47:15.5+00:00

Hello Team,

I'm trying to export the list of site owners, site storage details for all the SharePoint online sites available in the tenant using the below script. But this script is not providing any owner details if the owner group is provided with M365 group email address(******@yyyy.onmicrosoft.com).

Is there any way to get the complete list of site owners details even if it is linked with M365 group email address. Connect-SPOService -Url https://company-admin.sharepoint.com -Credential $cred

$siteCollections = Get-SPOSite -Limit All

$siteInfo = @()

foreach ($site in $siteCollections)

{

$storageUsage = $site.StorageUsageCurrent

$storageQuota = $site.StorageQuota

$siteUrl = $site.Url

$siteOwner = $site.Owner

$siteInfo += [PSCustomObject]@{

SiteUrl = $siteUrl

Owner = $siteOwner

StorageUsed = $storageUsage

StorageQuota = $storageQuota

}

}

$siteInfo | Format-Table -Property SiteUrl, Owner, StorageUsed, StorageQuota;

$siteInfo | Export-Csv -Path "C:\Temp\SOQ.csv" -NoTypeInformation

  Thanks & Regards,

Tamil

Microsoft 365 and Office | SharePoint Server | For business
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Austin-H 3,285 Reputation points Microsoft External Staff Moderator
    2025-05-22T14:26:36.2966667+00:00

    Hi @tamilarasan I,

    Thank you for posting your question in the Microsoft Q&A forum.  

    Based on the information you have provided, it looks like you want to retrieve all site owners information including M365 group. 

    Firstly, I want to ask that you can only get the information from the Communication Site right? If yes, then I have some thoughts. 

    When a Team Site is created, an M365 Group is automatically created in the background. This M365 Group itself is considered as the "owner" of the site. 

    The Primary Admin field often displays the name of the M365 Group rather than a specific user's email address (because it has multiple owners). 

    To sum up: 

    • For M365 Group-connected sites (or Team sites), it shows "Group owners" because the M365 Group is the designated owner. The actual owners are the people in that group. 
    • For standalone sites (Communication sites), it shows the specific individual user who was assigned as the Primary Site Collection Administrator. 
    • If Primary Admin is shown as "Group Owner", you cannot get the site owner information. Because the group contains many owners, it cannot return to a specific user. 

    User's image User's image

    Please correct me if my understanding is wrong. As my testing environment is also returning the same result as yours, which reflects my thought about this. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.