Skip to content

Get-MgmtGraphGroupCount

MgmtGraph: Retrieves the total count of groups in the tenant

#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Groups

[CmdletBinding()]
Param ()

Process {
    try {
        $count = Get-MgGroupCount -ConsistencyLevel eventual -ErrorAction Stop
        
        $result = [PSCustomObject]@{
            GroupCount = $count
            Timestamp  = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.