Ok, so I've got the output going to a csv file using Export-Csv and am now trying to trim off the output I don't need.
Here's my line of script-
Get-Counter "\Processor(_Total)\% Processor Time" -SampleInterval 1 -MaxSamples 10 | Export-Csv c:\data.csv
The output I'm getting is this-
##-Edit: The formatting of my original post didn't come across. When viewed in Excel the file 1) is the first line, 2) the second, etc. The columns are Readings, Timestamp, and CounterSamples, with the appropriate data filling out the rest of each column.
1) #TYPE Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSampleSet
2) Readings Timestamp CounterSamples
3) \\computer\processor(_total)\% processor time: 5/29/2012 8:59 Microsoft.PowerShell.(etc)
1.560698633212
4) \\computer\processor(_total)\% processor time: 5/29/2012 8:59 Microsoft.PowerShell.(etc)
0.4782....
And so forth. What I'm trying to do now is get just the processor usage number from the first cell. I'm thinking that I can achieve this by piping the output from Get-Counter through a Where-Object on the way to Export-Csv and doing some string manipulation in there as well. I'm just not sure what object I need to get. I've tried Title and Heading to no effect. Any ideas on what object I should be trying to get or a way I can determine the appropriate object? Am I barking up the wrong tree altogether?