Skip to content

Get-MgmtGraphGroupSettingCount

MgmtGraph: Retrieves the count of group setting objects

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

[CmdletBinding()]
Param (
    [string]$GroupId
)

Process {
    try {
        $params = @{
            'ErrorAction' = 'Stop'
            'Headers'     = @{ 'ConsistencyLevel' = 'eventual' }
        }
        if ($GroupId) {
            $params.Add('GroupId', $GroupId)
        }

        $count = Get-MgGroupSettingCount @params
        
        $result = [PSCustomObject]@{
            GroupId      = $GroupId
            SettingCount = $count
            Timestamp    = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

Optional. The unique identifier of the Microsoft Graph group to get settings count for.

An interactive directory of PowerShell scripts.