Author Posts

June 1, 2018 at 2:53 pm

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*

June 1, 2018 at 4:51 pm

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}

June 1, 2018 at 5:22 pm

Thank you! Looking at this all now