Skip to content

Get-MgGroupMember for large Group #949

@BohrenAn

Description

@BohrenAn

Hi there, i've got a very large AAD Group with 35'392 Members

$Group = Get-MgGroup -Filter "DisplayName eq 'DG_MDM_MDS'
$Members = Get-MgGroupMember -GroupId $Group.Id -All

After a while the PowerShell Window get's closed.

Or i get this Error in Windows Terminal
$Group = Get-MgGroup -Filter "DisplayName eq 'DG_MDM_MDS'"
$Members = Get-MgGroupMember -GroupId $Group.Id -All -Property UserPrincipalName,OnPremisesSamAccountName,UserType,AccountEnabled

Process is terminated due to StackOverflowException.
[Verarbeitung des Prozesses mit Code 3221225725 beendet]

I could do Paging, but the max is 999 Members.
$Members = Get-MgGroupMember -GroupId $Group.Id -PageSize 999

How do i know, that there are more Members available and page through the next paging batch?
Skip Parameter did not work - if that was the way to go to the next Page

PS C:> $Group = Get-MgGroup -Filter "DisplayName eq 'AAD-IcewolfUsers'"
PS C:> $Members = Get-MgGroupMember -GroupId $Group.Id -PageSize 3 -skip 0
Get-MgGroupMember : '$skip' is not supported by the service.
In Zeile:1 Zeichen:1

  • $Members = Get-MgGroupMember -GroupId $Group.Id -PageSize 3 -skip 0
  •   + CategoryInfo          : InvalidOperation: ({ GroupId = d59...ndProperty =  }:<>f__AnonymousType27`9) [Get-MgGrou
     pMember_List3], RestException`1
      + FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.GetMgGroupMember_List3
    
    

Regards
Andres

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions