What is the command to remove a user from AD group using Remove-QADGroupMember from the same domain and aswell as different domain?
- Products
- Solutions
- Resources
- Trials
- Support
- Partners
- Communities
What is the command to remove a user from AD group using Remove-QADGroupMember from the same domain and aswell as different domain?
I think the -Service switch is what you are looking for:
Remove-QADGroupMember -Identity $MyGroup -Member $MemberName -Service "DomainA.local"
Remove-QADGroupMember -Identity $MyGroup -Member $MemberName -Service "DomainB.local"
If you have Active Roles and all of your domains are managed by it, you could also try this:
# This will enumerate all instances of the group from all domains managed by Active Roles
Get-QADGroup -proxy -Identity $MyGroup | foreach {
Remove-QADGroupMember -proxy -Identity $_.DN -Member $MemberName
}
In the second case, the assumption is that $MyGroup contains the Name/CN or samaccountname of the group.
In the second case, the assumption is that $MyGroup contains the Name/CN or samaccountname of the group.