Experiencing a wierd issue, that hopefully someone can help me out with.
I have a script that retrieves users from AD, formats the headings to be what I want, but if I pipe to Export-Csv, then everything is wrapped in double quotes, which I read that is what it will do by default. So instead of using Export-Csv I use the following command
$results | ConvertTo-Csv -NoTypeInformation -Delimiter "`t" | ForEach-Object { $_ -replace '"', ""} | Out-File $outPutFile -Force -Encoding ASCII -ErrorAction SilentlyContinue -ErrorVariable onErrorWhich after that, my CSV file is formatted exactly how I want it, and everything isnt wrapped in double quotes. Now the issue is when I use Import-CSV on that particular csv file. Once I load it into a variable, I do not have access to the headings as properties, as I would if I used Export-Csv instead. Any reason as to why? A csv file is a csv file no matter what was used to create it.
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technet