AD Script to add/check groups and members
Posted on 2012-08-21
I've been given an excel file with around 3,000 groups and it associated members for each group.
An extract from the excel sheet looks something like this:
Column A Column B
GROUP NAME MEMBERS
I've recieved some scripting to create the 3000 groups, so at the moment, I already have the groups created in AD. Now, I require some script to populate each group with members from the excel file i have above. It should follow the below logic:
- Check group name from column A
- Retrieve member name from column B
- Find the group in AD with the group name from column A
- Check if the group already has the member retrieved from column B
- If no, then add the member, if yes, then skip and go to the next row in the excel file
Can anyone suggest some scripts on how i can achieve this?
Thanks for the support.