how to delete membership from a user when groups are in a different domain ?

My goal :  how to remove membership of groups from a domain from people that are in an other domain ?

I have two domains AAA and BBB.
for this case  i'm only using users from AAA : user@AAA

I have groups in both domains.
grp_aaa01, grp_aaa02
grp_bbb01, brp_bbb02

people from domain AAA are member of groups of domain BBB.

what would be the command in order to be able to delete groups of domain  BBB for users in domain AAA.
So far my command is trying to look to user in domaine BBB even when i'm giving the UPN.

Remove-ADGroupMember -identity grp_bbb01 -Member user@AAA -server BBB -Confirm:$false 

Open in new window

^  this is throwing an error :  can not find an object with identity user@AAA under domain BBB , objectNotFound ....

how can i do this ?
thank you in advance.
Erwin PombettAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Omar SoudaniSenior System EngineerCommented:
Remove-ADGroupMember will try to resolve the identity  from BBB domain only that's why you're getting the error. You need to get cross-forest/domain object using the ADPowershell cmdlets and then supply it as input to –Members or –MemberOf parameter of the cmdlets. Here for more clarifications and step by step guide:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.