Get-MgmtGraphGroupMemberObject
MgmtGraph: Retrieves parent directory object IDs for a group
#Requires -Version 5.1
#Requires -Modules Microsoft.Graph.Groups
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$GroupId,
[bool]$SecurityEnabledOnly = $false
)
Process {
try {
$params = @{
'GroupId' = $GroupId
'SecurityEnabledOnly' = $SecurityEnabledOnly
'ErrorAction' = 'Stop'
}
$objectIds = Get-MgGroupMemberObject @params
$results = foreach ($id in $objectIds) {
[PSCustomObject]@{
SourceGroupId = $GroupId
MemberOfObjectId = $id
Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
}
}
Write-Output $results
}
catch {
throw
}
}The unique identifier of the child Microsoft Graph group.
Optional. If set to $true, returns only security-enabled parent directory objects. If $false, returns all objects.