Shadow_Walker Posted March 16, 2018 Posted March 16, 2018 Been looking around online but to no real look. I need to remove all group memberships (security groups) from quite a few users. They are now bunched together in an OU but need a simple way of removing group memberships. Like always hoping for a GUI unless it is a simple powershell script!
Duke5A Posted March 20, 2018 Posted March 20, 2018 This will remove all security groups from all users contained within a specified OU with the exception of the 'Domain Users' group. Be sure to test this on a few temp users before releasing it into the wild. Import-Module ActiveDirectory $users = Get-ADUser -SearchBase "OU=Students,OU=Users,DC=domain,DC=com" -Filter * foreach($user in $users){ $groups = Get-ADPrincipalGroupMembership $user.SamAccountName | Where-Object {$_.name -NotLike '*Domain*'} foreach($group in $groups){ Remove-ADGroupMember -Identity $group -Members $user } } 1
ADMaster Posted March 21, 2018 Posted March 21, 2018 If you really want a GUI Bulk AD users should do it, but +1 for Duke5a's powershell 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now