I have multiple domains on my server. I need to check whether a user is a member of which group using powershell.
When i try :-
Import-Module ActiveDirectory Get-ADUser 'sam'
I get an error:-
Get-ADUser : Cannot find an object with identity: 'sam' under: 'DC=ad,
DC=company,DC=com'.
Actually, the user 'sam' exists in some other domain in Active directory, So How do I connect to a particular domain, have the script to look for 'sam' in the domain i connect to, and list the "member of" 'sam'?