I have a csv file:
"SamAccountName","UserPrincipalName","Telephonenumber"
"TUser","[email protected]","+15551112222"
I loop through the file:
$csvfile = Import-Csv $path
foreach ($row in $csvfile) {
Write-Host $row.SamAccountName, "$row.SamAccountName"
}
The first $row.SamAccountName prints the sam account name string from the csv file. If I put the same variable in quotes, it prints an array. My output looks like this:
TUser @{SamAccountName=TUser; [email protected]; Telephonenumber=+15551112222}.SamAccountName
If I do .GetType() on $row.SamAccountName is says its a System.String. So why does putting it in quotes print an array?