Get-AdUser -Server: how do you include all domains?

Hi all,

I’m trying to build a command from Get-AdUser in Powershell to include all the domains my enterprise has to query a user for different things. I tried the below but it didn’t work. Can someone suggest a right way to do this, if possible?

Get-ADUser [username] -Server "domain1", "domain2" -Properties * | select name, password*

You can use the Windows Server ADAC to write this code for you which you can later tweak as needed.
You’d use the ADAC GUI, to navigate the actions you’d like, open the ADAC PowerShell History viewer to see the script code.

Simply, it’s something like…

'domain1', 'domain2'| %{Get-ADUser -Filter * -Server $_ | Select Name,password*}

# or 

$EnterpriseDomains = "domain1", "domain2"
$EnterpriseDomains | %{Get-ADUser -Filter * -Server $_ | Select Name}

Thank you! Looking at this all now