H
H
hixr0k2019-05-08 13:54:36
PowerShell
hixr0k, 2019-05-08 13:54:36

How to get information using PowerShell about an account in another domain?

The task is as follows, it is required to display information about accounts (with e-mail and not disabled) in another domain, there is trust between domains.
I enter the command:

Get-ADUser -Filter {(mail -ne "null") -and (Enabled -eq "true")} -Properties mail -SearchBase 'OU=FN,DC=tc,DC=xx,DC=local' -Server tc.xx.local | Select-Object Name,mail | Format-Table

Information is not displayed
If I enter this on the current domain, then everything is displayed:
Get-ADUser -Filter {(mail -ne "null") -and (Enabled -eq "true")} -Properties mail -SearchBase 'OU=test,DC=ct,DC=xx,DC=local' -Server 'ct.xx.local'| Select-Object Name,mail | Format-Table

Tell me where is the mistake?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vadim Choporov, 2019-05-08
@tolstyiii

You have the same dc name and search domain name. Most likely -SearchBase 'OU=FN,DC=xx,DC=local'.
When you request just any object from a neighboring domain, do you get anything? What mistake?

H
hixr0k, 2019-05-13
@hixr0k

Vadim Choporov
When I try to get information from a neighboring domain, nothing happens, it just switches to a new line and there are no errors:
And if I enter in the current domain, I get the necessary information
I noticed now one moment, when I run the command:
An error appears: Get-ADDomain : Unable to establish a connection with the server. Possible causes: The server does not exist, is down, or is not running Active Directory Web Services.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question