All scripts
Microsoft 365 658
Get-EntraGroupOwnerReport
Lists every Microsoft 365 and security group with its owners, flagging groups that have no owner at all, since ownerless groups cannot be self served and pile up as support tickets.
Get-EntraGroupOwnerReport.ps1
<#
.SYNOPSIS
Reports group ownership and flags ownerless groups.
.DESCRIPTION
Lists every Microsoft 365 and security group with its owners, and
flags any group with zero owners, since those groups cannot be
self service managed and quietly turn into support tickets.
.EXAMPLE
.\Get-EntraGroupOwnerReport.ps1
.NOTES
Requires Microsoft.Graph.Groups with an active Connect-MgGraph
session.
.AUTHOR
Shehryar Hassan
#>
$groups = Get-MgGroup -All
$report = foreach ($group in $groups) {
$owners = Get-MgGroupOwner -GroupId $group.Id
[pscustomobject]@{
GroupName = $group.DisplayName
OwnerCount = $owners.Count
Owners = ($owners | ForEach-Object { $_.AdditionalProperties.displayName }) -join ", "
}
}
$report | Where-Object { $_.OwnerCount -eq 0 } | Format-Table GroupName -AutoSize
Write-Warning "$(($report | Where-Object { $_.OwnerCount -eq 0 }).Count) of $($groups.Count) group(s) have no owner."
Read it before you run it, and test in a safe tenant first.