This topic contains 5 replies, has 2 voices, and was last updated by
November 5, 2018 at 12:58 pm #121858
I want remove bulk users from an AD group, and the below command is working me, if group and users are in same domain, since our AD environment has one forest with three child domains, this command fails if the group or users were in different domain, I tried using $DC from group Domain/Domain Controller, User Domain/Domain Controller and global catalog, but it fails. could anyone help on this. Thanks in advance.
Remove-ADGroupMember -Identity $GroupName -Server $DC -Members $user -Confirm:$false
November 5, 2018 at 1:03 pm #121878
What's the error that you are getting? Why does it fail?
November 5, 2018 at 1:35 pm #121891
I received below error in the provided scenarios:
when using global catalog as $DC
ERROR: remove-ADGroupMember : The server is unwilling to process the request
when using the Group domain as $DC
ERROR: remove-ADGroupMember : Cannot find an object with identity: 'UserName' under: 'Group domain'.
when using the user domain as $DC
ERROR: remove-ADGroupMember : Cannot find an object with identity: 'GroupName' under: 'User Domain'.
November 5, 2018 at 1:43 pm #121903
What happens if you try to save the objects from their corresponding Domains to variables first, before trying to remove users from a group?
$User = Get-ADUser -Server user.domain $Group = Get-ADGroup -Server group.domain Remove-ADGroupMember -Identity $Group -Members $User
November 5, 2018 at 2:08 pm #121918
Great... It works...
Thanks a lot
November 6, 2018 at 6:42 am #122087
No worries! Glad to be of help.
The topic ‘Remove bulk users from a Group(multi domain environment)’ is closed to new replies.