Powershell: AD Groups
Posted by: Colin Smith
Two weeks ago was part of implementing a large upgrade in one of our Sybase environments. In order for this upgrade to be succesful we had to do some work in some AD groups. We needed to find all the users that would need to be a member of the new group that we were creating and take them out of the old group. The old group still needed to be around though, for users that were not affected by the upgrade. I knew that I would we had one group, that all the affected users were already a member of, so I could copy that groups members into the new group. However, if I did not also take these users out of the old group, then nothing would work. So here is what I did.
$users = Get-QADGroupMember "GroupA" foreach ($user in $users){ $user | Remove-QADGroupMember "GroupB" $user | Add-QADGroupMember "GroupC"
Keep in mind that you will need the Quest AD cmdlets installed in order for this to work.
Let me know if you have any questions.




