This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Script Search - divide 1000 computers into 9 groups based on attribute value

I have what should be a very simple task on my plate that I can't seem to hit with a fork.

I have 9 groups and 2000 servers.  I need to split the servers between the groups ...

and as a maintenance workflow, when a new server comes online, after update of the OS value, move it into the least populated of the 9 groups.

I have a script started, that populates a native attribute on server objects with their AD site.  I divide the collected site names into two collections.  Each collection contains a couple thousand servers mapped to those sites.  I have 9  AD groups for each site collection..  I can split 2000 by 9, but here's the black hole in my logic, Nested Loops..

Do you have any scriptlets or script samples that demonstrate how to loop foreach group, add 1/9th of the 2000 servers into said group, then for the next group, grab the next 1/9th of the servers, etc ...  until done, amen.

fun times.

thanks in advance