Currently, I pull data from AD (approx. 25000 records) , DFS Namespace 1 (approx. 13000 records), DFS Namespace 2. I have a function that loops thru each AD user, does a lookup in the DFS Namespace 1 and 2 and builds a result PSObject. As requirements have continually changed, I’ve added more for loops and if blocks for each user to be processed, so this script that was running in 45 minutes is now taking like 5 hours.
I’m looking for ways to make the script more efficient. For instance, if I build each data object with a common attribute (e.g. SamAccountName), has anyone attempted to do a Join on multiple datasets with an attribute. I’ve seen blogs like http://blogs.msdn.com/b/powershell/archive/2012/07/13/join-object.aspx, but they still take a while to Join. Is it possible to convert them to DataTables and do SQL type join to get a final result set (like LINQ). Just curious if any of the experts have worked something like this and what was found to be the most efficient way to build a final result with all of the data joined together.
I can provide code, but I’m just curious if someone has had a similar scenario and if they’ve measured 15 different options and came to a consensus on the best approach. Thanks