All scripts
Governance 154

Get-TeamsOwnerlessTeamsReport

Finds every team that has zero active owners, which happens more often than expected once the original creator leaves the company, leaving nobody able to manage settings or membership.

Get-TeamsOwnerlessTeamsReport.ps1
<#
.SYNOPSIS
    Finds teams with no active owners.

.DESCRIPTION
    Checks every Microsoft 365 group backing a team and flags any with
    zero owners, which happens more often than expected once the
    original creator leaves the organization, leaving the team with
    nobody able to manage settings or membership.

.EXAMPLE
    .\Get-TeamsOwnerlessTeamsReport.ps1

.NOTES
    Requires Microsoft.Graph.Groups and Microsoft.Graph.Teams with an
    active Connect-MgGraph session.

.AUTHOR
    Shehryar Hassan
#>

$teams = Get-MgGroup -Filter "resourceProvisioningOptions/Any(x:x eq 'Team')" -All

$ownerless = foreach ($team in $teams) {
    $owners = Get-MgGroupOwner -GroupId $team.Id
    if ($owners.Count -eq 0) {
        [pscustomobject]@{
            TeamName  = $team.DisplayName
            GroupId   = $team.Id
            CreatedOn = $team.CreatedDateTime
        }
    }
}

if ($ownerless) {
    $ownerless | Format-Table -AutoSize
    Write-Warning "$($ownerless.Count) team(s) have no active owner."
} else {
    Write-Host "Every team has at least one owner." -ForegroundColor Green
}

Read it before you run it, and test in a safe tenant first.