We have multiple domains with a trust in between. I need to compile a CSV combining both of these commands, with accounts from one OU and its sub-OUs:
Get-ADuser -Filter * -SearchBase "OU=Company1,DC=domain,DC=local" -properties * | Select-Object Name,Mail,EmployeeId
Get-Mailbox | Select-Object -ExpandProperty Name,SamaccountName,LinkedMasterAccount,ObjectClass
Basically I need to work up a CSV that shows the Name and EmployeeID from Get-ADUser, and the SAMAccountName and LinkedMasterAccount (from the other domain), that is obtained from the Get-Mailbox command. Can anyone help? I've been at it for 5 hours, and still cannot get it to work. From my reading I need to create an array and such, but it's really beyond me, and I'm not getting anywhere. Thanks so much!