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?
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.