List all ADGroups and all their Users

  • mtz676

    SSCrazy Eights

    Points: 8704

    ForEach ($Group in (Get-Content c:\text.txt)) { Get-ADGroupMember $Group | Select @{Label="Group";Expression={$Group.Name}},Name,SamAccountName }

    I have the above piece of powershell code which displays Group,name and samaccountname in the window.
    Sometime I get this error "Get-ADGroupMember : The size limit for this request was exceeded" and the results continue thereafter.

    How can I ignore that error and also include all those members which belong to that relevant group causing this error.
    I would like to export the results into a tab delimited text extract.

    Thanks

  • Sue_H

    SSC Guru

    Points: 89720

    mtz676 - Friday, October 12, 2018 1:01 AM

    ForEach ($Group in (Get-Content c:\text.txt)) { Get-ADGroupMember $Group | Select @{Label="Group";Expression={$Group.Name}},Name,SamAccountName }

    I have the above piece of powershell code which displays Group,name and samaccountname in the window.
    Sometime I get this error "Get-ADGroupMember : The size limit for this request was exceeded" and the results continue thereafter.

    How can I ignore that error and also include all those members which belong to that relevant group causing this error.
    I would like to export the results into a tab delimited text extract.

    Thanks

    It's an issue with the AD web service. There are a couple of different work arounds you can try in this thread (change the config file or change the code):
    How do I resolve the "Size limit exceeded for Get-Adgroupmember" error when listing a group with thousands of members?

    Sue

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply