switch01#show interfaces counters errors
Port Align-Err FCS-Err Xmit-Err Rcv-Err UnderSize OutDiscards
Port Single-Col Multi-Col Late-Col Excess-Col Carri-Sen Runts Giants
I try to process the text like this:
My main problem is that the output from the switch is split up into 2(or more depending on switch type) blocks of text.
Can ConvertFrom-Csv do this, or do I have to revert to reading line by line and constructing the Objects based on
The two tables thing is annoying. You could isolate the two tables into their own strings or arrays of strings, and use ConvertFrom-Csv on each on separately, then pass the two to something like Join-Object (which you'll have to search for; it's not part of PowerShell out of the box), but personally, I'd probably just write code to handle this format directly. You'd have to do some parsing to split the tables up anyway, and if you're going to that effort, may as well just build the objects properly in one shot rather than having to use Join-Object to combine them later.
Please test if below code works for you.
You must be logged in to reply to this topic.