Get-AdUser from another domain with a trust relationship

pierreraji-7183 21 Reputation points
2021-01-07T15:37:20.16+00:00

Hello,

I have two domains A and B with a two-way trust relationship.
I want to search for a domain A user through a domain B account.
I tried the following command but I got a return that it can't find the information.

Get-AdUser -Server "Domain_A" -Identity "Name_of_account" -Credential "Domain_B\Account" -Properties *

The computer with powershell does not have access to the network of domain A, it must make the request on domain B which interrogates domain A and get the answer of domaine B.

Is it possible ?

Thanks in advance

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Thameur-BOURBITA 36,261 Reputation points Moderator
    2021-01-08T09:06:02.153+00:00

    Hi,

    It can be a network flow issue, Try to specify a domain controller name of domain name :

    Get-AdUser -Server "DC.Domain_A.local" -Identity "Name_of_account" -Properties *
    

    It's not necessary to add a credential from target domain.


    Please don't forget to mark helpful reply as answer

    2 people found this answer helpful.
    0 comments No comments

  2. pierreraji-7183 21 Reputation points
    2021-01-08T11:04:27.557+00:00

    Hi

    Thanks for your answer.
    It's two domain and two forest.

    54881-powershell-domain-a-b.png

    IF I understood correctly:

    1 - / I query the DNS of my domain B, to obtain information about an account in domain A.

    2- / DNS of domain B looks and sees that there is a conditional forwarder for domain A. It sends the query back to DNS of domain A

    3- / Domain A answer to domaine B

    4- / Domain B give the answer at the computer.

    I don't have network access to query domain B DNS, Because the relationship of trust between the two domains allows information to be shared.

    Is it OK ?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.