Today I was asked to help a fellow administrator get a list of users and add all of these users to a specific group. The users that he was interested in were all the users that he had moved to Exchange since starting his migration process. In order to get this list of users we used the Exchange Management Shell and the get-mailbox command to get the list. Once we had the list we needed to add these users to a specific group. We could have used ADSI to do this but I thought it was a great time to learn more about and use the AD Command-Lets that Quest Software has provided for free. So now we have the list of users and we formatted it to only give us the lastname, firstname. Now I added the snap in for the new command lets and we were off. Here is what we did and it worked just great.
$users = get-content “List of users”
Foreach($user in $users)
Add-qadgroupmember –Identity “CN=GroupName,OU=OUName,DC=DCName” –Member $user
Just that simple and we added about 450 users to the group that we needed. This was a fun one to do and nice to learn more about the Quest tools. They did a good job on the AD Command lets and I appreciate them making them available for all. If you have any questions or comments about this please let me know by leaving a comment here or by heading to my website SysAdminSmith.com and submitting a question to me. I will get back to you either way.