Asked by:
PowerShell- Finding Active Directory user properties in child domains

Question
-
Hi ,
I am new to PowerShell. In our company we have multiple child domains. Let say forest domain america.com and child domains as x.america.com, and z.america.com
How can I run a powershell cmdlet so that I can get information related to specific childdomain. For example, I want to find the active directory users properties in z.america.com child domain.
Regards,
San
- Edited by SANCS Saturday, June 2, 2018 2:22 PM
Saturday, June 2, 2018 10:22 AM
All replies
-
You Could Use Enter-PSsesion By Powershell, But You Must Have Functional Credential in the Forest.
If You Coulden't Use Enter-PSsession cmdlet, You Must Use (Just Once) :
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
To Access The Powershell Of Another DC.- Proposed as answer by Mohsen Amiri1 Saturday, April 6, 2019 11:18 AM
Saturday, June 2, 2018 10:40 AM -
Hi Sancs
If you have a domain trust between the domain you should just be able to specify a DC on the other domain using -server switch you can also specify the OU you want to search using -searchbase see below example.
Get-ADUser -Server "DC.domain.local" -SearchBase "OU=SALE,DC=Doamin,DC=Local"
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
- Edited by TheSleepyAdmin Saturday, June 2, 2018 12:17 PM
Saturday, June 2, 2018 12:15 PM -
Thanks for the reply Geoff.
I ultimately found the solution. Let me explain it more clearly.
We have a forest domain and multiple child domains.
Example: america.com is our forest domain and the child domains are x.america.com , y.america.com and z.america.com
I was trying to find a user's properties in active directory in child domain, say z.america.com. I used the following cmdlet:
Get-ADUser -Filter {Name -eq "Smith, John"} -Server abc.com -Properties *
Note: you have to find the name of the server (abc.com) of your child domain
Saturday, June 2, 2018 1:25 PM -
Thanks for the reply Geoff.
I ultimately found the solution. Let me explain it more clearly.
We have a forest domain and multiple child domains.
Example: america.com is our forest domain and the child domains are x.america.com , y.america.com and z.america.com
I was trying to find a user's properties in active directory in child domain, say z.america.com. I used the following cmdlet:
Get-ADUser -Filter {Name -eq "Smith, John"} -Server abc.com -Properties *
Note: you have to find the name of the server (abc.com) of your child domain
No. Not necessary. Just use the domain fqdn. The network will find server for you.
Get-ADUser -Filter {Name -eq "Smith, John"} -Server z.america.com-Properties *
Note that you can also "ping" a domain by name:
ping z.america.com
\_(ツ)_/
Saturday, June 2, 2018 3:04 PM