Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitOne of the most overlooked issues in Microsoft Teams administration is when a Team ends up with no owners. This usually happens when the original owner leaves the organization or changes roles without assigning a replacement. The problem? No one can manage membership, approve requests, or adjust settings for that Team. Over time, these "orphaned Teams" pile up, creating security risks, governance gaps, and frustrated end users who can’t get their issues resolved.
To tackle this, you can use a simple Graph PowerShell script that scans your tenant and identifies all Teams that don’t have an owner. Once you have this list, you can take action—either reassigning ownership, archiving the Team, or notifying administrators.
# Connect to Microsoft Graph with required scopes
Connect-MgGraph -Scopes "Group.Read.All", "User.Read.All", "Directory.Read.All"
# Get all groups that are Teams-enabled
$teamsGroups = Get-MgGroup -Filter "resourceProvisioningOptions/Any(x:x eq 'Team')" -All
foreach ($group in $teamsGroups) {
# Get owners of the group
$owners = Get-MgGroupOwner -GroupId $group.Id
if ($owners.Count -eq 0) {
Write-Output "Team '$($group.DisplayName)' (ID: $($group.Id)) has no owners."
}
}
Uses delegated scopes Group.Read.All, User.Read.All, and Directory.Read.All to read groups and owners.
Filters Microsoft 365 groups whose resourceProvisioningOptions contains "Team"—i.e., groups that back Microsoft Teams.
For each Teams group, retrieves owners with Get-MgGroupOwner. If the owner collection is empty, it prints a line indicating the Team has no owners.
The script writes a simple message for each unowned Team; it’s easy to capture or redirect to a file.
Error | Cause | Solution |
---|---|---|
Insufficient privileges to complete the operation | Missing or unconsented Graph scopes | Reconnect using the exact scopes shown and ensure consent is granted. |
The term 'Get-MgGroup' is not recognized | Microsoft Graph module not installed/loaded | Install Microsoft.Graph module and re-run Connect-MgGraph. |
Empty results (no Teams found) | No Teams-backed groups, or filter mismatch | Verify Teams exist; remove the filter temporarily to validate group retrieval. |
Throttling / intermittent failures | Large tenants or frequent calls | Add delays/retries, or page/parallelize responsibly if you extend the script. |
Access denied on owners | Directory role restrictions / conditional access | Run as an account with directory read permissions and compliant sign-in. |
This lightweight script quickly surfaces Teams with no owners, a key governance gap. From here, you can export findings, notify stakeholders, or auto-remediate by assigning fallback owners—keeping your Microsoft Teams environment healthy, compliant, and manageable.
© m365corner.com. All Rights Reserved. Design by HTML Codex