I`m trying to figure out a way to retrieve a list of site collections whose owners match a list of email addresses I extract from an AD group.

The following code gives me a list of email addresses stored in a variable as an array.

$group = "CONTOSO"
$users = Get-ADGroup -Filter {Name -like $group} | Get-ADGroupMember -Recursive | 
Select-Object -Unique | 
Get-ADUser -Properties Mail |
Select-Object Mail |
Sort-Object Mail

I would like to get all owners of a site collection in my tenant that is on that list and output the site collection name.

However, I`ve been unable to get the owner email addresses from all site owners in our tenant let alone compare them to the extracted AD email addresses.

I tried this code to retrieve all owners of site collections in the tenant.

Get-SPOSiteGroup -Site https://contoso.sharepoint.com/ |
Where-Object {$_.Title -eq "Owners"} | Select-Object Users

Any help is much appreciated.


1 Answer 1


Try below code

Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue

Get-SPWebApplication "https://contoso.sharepoint.com/" | Get-SPSite | foreach-object { Write-host $_.Url - $_.Owner.Email}

Ref : Click Here

  • Thanks for your reply. Unfortunately, I am on SP Online and PowerShell 5 so those cmdlets do not work anymore. If I do: <br/> Get-SPOSite -Identity contoso.sharepoint.com | foreach-object {Write-host $_.Url -$_.Owner.Email} it returns: contoso.sharepoint.com -Microsoft.Online.SharePoint.PowerShell.SPOSite.Owner.Email Mar 16, 2017 at 7:06

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.