Link to home
Start Free TrialLog in
Avatar of John Questionaire
John Questionaire

asked on

Output objects to different columns

I have a script that pulls a list of users from a distribution list, gets their display names and their managers into corresponding arrays, but I'm trying to figure out how to get the two into separate columns. Here's what I have so far:

$group = read-host "Group Name"

$groupMembers = @(Get-ADGroupMember -identity $group)

$userDispName = @()
$manager = @()

ForEach ($user in $groupMembers) {
    $userDispName += (Get-ADUser $user -Properties DisplayName).displayname
    $manager += (Get-ADUser ((get-aduser (get-aduser $user -Properties manager).manager).samaccountName) -Properties DisplayName).displayname
    }

$managerList = @($userDispName,$manager)
$managerList | out-file ManagersList.csv
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Questionaire
John Questionaire

ASKER

Thank you so much! ^_^
It worked perfectly.

You even caught my typo XD