Tip: You are logged in domain1 and you want to search a user located in domain2.
1 2 3 4 5 |
# Domain name Get-ADUser -Server 'domain2.com' -Filter { SamAccountName -eq 'sPowershell' } # Directory server Get-ADUser -Server 'dc.domain2.com' -Filter { SamAccountName -eq 'sPowershell' } |
Note: Get-ADUSer requires ActiveDirectory module.