My $file contains two columns. Using the username in ., I would like to add name and givenname as the third and fourth columns respectively. So far I have:
$file = Import-Csv H:\computers2userswoSP1.csv
$out = foreach ($o in $file.name) {
Get-ADUser $o | select name, givenname
}
I tried adding the code below into the first foreach, but that didn't work:
foreach ($r in $out) {
New-Object PSObject -prop @{
name = $file.fullname
givenname = $file.Firstname
}
}
and also adding this before the loops:
Add-Member -InputObject $file -TypeName fullname
Add-Member -InputObject $file -TypeName Firstname
with this in the loop:
$out.givenname += $file.FirstName
$out.name += $file.
As you can see, I'm shooting in the dark a little. Any recommendations?
$outto be? A custom object? A multidimensional array where each object in the array is another array with a set of values?