Powershell Bulk Find ActiveDirectory Objects


I’m trying to develop a powershell script to help with AD Group Membership management. We have a handful of large groups (30k-60k+ objects) that we want to update with data from another system.

The script loads the objects that should be in the group from a text file. Each object then has to located in AD using a System.DirectoryServices.DirectorySearcher. After that each object is added to the group membership.

The script spends some 80% of its time looking up each object, is there a bulk way to find objects in AD with powershell?



This is the fast way to query AD that I found in my experience, you need to change the query to find specific objects, in this code you’ll find all user/person object in $objRecordSet.

More info here


Powershell Bulk Find ActiveDirectory Objects by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply