Bitvise .log files that are actually XML files to CSV.

Hey all,

We switched from FileZilla to Bitvise so my Filezilla script that /r/powershell (thank you again, u/gangstanthony ) helped with has been scrapped.

The Bitvise .log file looks like this https://pastebin.com/kRHawpaG

If I can start with expanding that XML file to something like a CSV file I can start picking what info I want and narrow down my CSV file or just soak up the CSV file in Power BI and edit it there.

My issue is I have never worked with XML files like this before.

I found the $CSV bit online last week but that doesn’t return anything in the .csv.

$scriptpath = "C:PSCodeProjectsBitviseLogParser" $csv = @(($xml = [xml](Get-Content "\192.168.0.2c$Program FilesBitvise SSH ServerLogsBvSshServer20190211-080633728-M0700.log")).SelectNodes('//columnHeader').'#text' -join ',') $csv += $xml.SelectNodes('//ReportRecord').ForEach{$_.item -join ','} $csv | ConvertFrom-Csv | Export-Csv $scriptpathoutput.csv 

I also need to find a better delimiter. Can’t find ~ in any of the reports. I guess I can use that.

submitted by /u/sysadminworkaccount
[link] [comments]

Leave a Reply