Hi Guys,
I´m trying to add a new column to an array an fill it with variables in a ForEach Loop.
I tried the following:
----------------------------------------------------
$CSV = Import-Csv -Path "H:\LAPTOP.csv" -Delimiter ";"
$descriptions = @()
foreach ($entry in $csv)
{
$Laptopname = $($entry.Laptopname)
$Username = $($entry.Username)
$PC = Get-ADObject -filter { (displayname -like $Username) } -Properties givenname, sn, description
$descriptions += $PC.description
}
$csv | Add-Member -MemberType NoteProperty -Name description -value $descriptions
----------------------------------------------
My target is to add the "description" field from "$PC.description" to the correct field in $csv description. But it allways outputs the whole array in every description field.
So how can i add a new column to my array and fill it in the foreach loop?