I have a powershell script that exports to a csv and I inserted a line to remove the quotations. It works if I run the powershell manually, but the quotation marks remain if i run in task scheduler!! Why does this happen?
#Output RESULTS to CSV
$DataSet.Tables[0] | select "ID" , "date" | Export-Csv $OuputFile -NoTypeInformation
set-content data.csv ((get-content data.csv) -replace '"')
Allow me to give you an alternative to what you already have, instead of exporting to CSV and then reading from the CSV and removing all double-quotes "
you can use ConvertTo-Csv
:
#Output RESULTS to CSV
($DataSet.Tables[0] | Select-Object ID, Date |
ConvertTo-Csv -NoTypeInformation) -replace '"' |
Out-File C:\data.csv