I have this script which is working but it is adding an extra carriage return at the end - how can I remove that extra line/carriage return at the end of the outputted file?
Thanks
Scott
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
Remove-Item "D:\Development\reports.csv" -ErrorAction Ignore
$tfs = Get-TFSServer http://tfs:8080/tfs
Get-TfsChildItem $/Vision/main/Reports/Standard -R -Server $tfs | ? {$_.CheckinDate -gt (Get-Date).AddDays(-5) } | Select-Object ServerItem | ConvertTo-Csv -OutVariable OutData -NoTypeInformation
$OutData[1..($OutData.count - 1)] | ForEach-Object {Add-Content -Value $_ -Path "D:\Development\reports.csv"}
Start-Sleep -s 2
$lines=@(get-content"D:\Development\reports.csv")
$newlines = @()
foreach ($line in $lines) {
$newlines += $line -replace "^(.*)/", "" -replace ".rdl""", "" -replace "'n", ""
}
$newlines | out-file "D:\Development\reports.csv"