So this sounds easy he said – run me a report that gets all objects from a group based on certain attributes and export it to Microsoft Excel.

No worries, I had that scripted for three groups to export to three different Excel files in under 10 minutes – until I ran it and came across¬†“Get-ADGroupMember¬†: The size limit for this request was exceeded”

Okay so I start doing some research thinking “this is just a speed bump” and I’ll sort it out in five minutes! I came across hundreds of people with the same issue and finding “workarounds” none of which worked.

I thought it might be best to publish this to the public in case someone else comes across it.

Now just to let everyone know if they know the answer already or have other solutions – I cannot go changing the maximum value and time limit on all the Domain Controllers.

The code:

$group = "GroupName"
Get-aduser -filter * -searchBase "DC=domain,DC=local" -properties * | ?{$_.memberof -match "$group"} | Select-Object Name,SurName,GivenName,department,mail,pager,division | export-csv C:\Output\report.csv

I’m getting the attributes “Name,SurName,GivenName,department,mail,pager,division” for this particular report but you can modify to your requirements.

Obviously you don’t need to do this for getting members of groups with under 1,500 objects.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.