Running the following cmdlet works for all users in the group membership (group in Amer domain), regardless of what domain the user listed resides in:
Get-ADGroupMember <group_name> -Server amer
However, when trying to get details on the users by piping to Get-ADUser
, I get errors for the users in a different domain (EMEA) then the group (AMER):
Get-ADGroupMember <group_name> | Get-ADUser
Here is the error returned after each user in a different domain (error users in EMEA domain):
Get-ADUser : A referral was returned from the server At line:1 char:46 + Get-ADGroupMember GBL-Storage-Admin-NAS-L2-U|Get-ADUuser + ~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (CN=EMASAN- WARNE...C=pfizer,DC=com:ADUser) [Get-ADUser], ADReferralException + FullyQualifiedErrorId : A referral was returned from the server,Microsoft.ActiveDirectory.Management.Commands.GetADUser
I can lookup each error user by specifying get-aduser <user> -Server EMEA
, but that is manual painfull when there is a lot of users.
How can I get the pipe to Get-ADUser
to work with users in other domains?