$filesremoved | export-csv -Path E:\Code\powershell\logs\filesremoved.txt -NoTypeInformation
I've also tried
$filesremoved | export-csv -Path E:\Code\powershell\logs\filesremoved.txt -NoTypeInformation -NoClobber
The file appears to be overwritten every time. Is there a way to keep adding content to the file?
I get errors
Export-Csv : A parameter cannot be found that matches parameter name 'Append'.
I have no idea what $filesremoved
include, but to append CSV-output in PS2.0, you could try somthing like this:
$filesremoved | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 | Out-File -Append -FilePath "test2.csv"
Select-Object -Skip 1
is used to remove the header. You should however specify the columns-order you need, the delimiter and maybe encoding, like:
$filesremoved | Select-Object -Property Name, Date | ConvertTo-Csv -Delimiter ";" -NoTypeInformation | Select-Object -Skip 1 | Out-File -Append -Encoding ascii -FilePath "test2.csv"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With