title: Measure-Object -sum all counterSamples from continuous get-counter
body: <p>I am trying to write a PowerShell script that will continuously poll a performance counter every N seconds then sum the values returned by the counter. 
  My end goal is to have results for a dozen or so counters get rolled  up and shipped off to a Graphite server for monitoring and reporting.</p>
  
  <p>so far this is what I have cobbled together for a particular counter, i'm just not sure how to get a couple of things in the land of PowerShell magic voodoo.</p>
  
  <ol>
  <li>I can't figure out how to get the Job ID as an integer so I can automate the while loop.</li>
  <li><p>Return only CounterSample data from Receive-Job that can be piped to Measure-Object to get a sum.</p>
  
  <pre><code>Start-Job {Get-Counter -Counter "\Network Interface(MyNic)\Bytes Received/sec" -Continuous -SampleRate 1}
  
  while ($true) { 
          start-sleep -s 10
          Receive-Job -id N
  }
  </code></pre></li>
  </ol>
  
  <p>I would also love to know a simple or effective way to dynamically determine the active NIC on a windows box in PowerShell v1.0 or v2.0. "\Network Interface(*)\" works but gives me everything.</p>