Skip to content

Get-MgmtGraphGroupPhoto

MgmtGraph: Retrieves group profile photo metadata

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

[CmdletBinding()]
Param (
    [Parameter(Mandatory = $true, Position = 0)]
    [string]$GroupId
)

Process {
    try {
        $photo = Get-MgGroupPhoto -GroupId $GroupId -All -ErrorAction Stop
        
        $result = [PSCustomObject]@{
            GroupId   = $GroupId
            PhotoId   = $photo.Id
            Height    = $photo.Height
            Width     = $photo.Width
            Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
        }

        Write-Output $result
    }
    catch {
        throw
    }
}

The unique identifier of the Microsoft Graph group.

An interactive directory of PowerShell scripts.