Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm monitoring the counnection count for each of my CAS servers and would like to concatenate the output of each of them so I can display it cleanly.

I've tried "adding" the results as in $rpc = $rpc + XXXCommandHereXXX, and piping as illustrated below, but I'm unable to "join" the commands.

 $rpc = (get-counter -ComputerName NYCEXCAS01 -Counter "RPC/HTTP Proxy\Current Number of Incoming RPC over HTTP Connections").countersamples  | Select-Object Path, CookedValue 
 $rpc | (get-counter -ComputerName NYCEXCAS02 -Counter "RPC/HTTP Proxy\Current Number of Incoming RPC over HTTP Connections").countersamples  | Select-Object Path, CookedValue 

Am I trying to do something that is logically unreasonable?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Don't perform the Select-Object on each Get. You should then have no problem "adding" the collections and Selecting the desired properties later:

$a = (get-counter -ComputerName NYCEXCAS01 -Counter "RPC/HTTP Proxy\Current Number of Incoming RPC over HTTP Connections").countersamples
$b = (get-counter -ComputerName NYCEXCAS02 -Counter "RPC/HTTP Proxy\Current Number of Incoming RPC over HTTP Connections").countersamples
$rpc = $a + $b
$rpc | Select-Object -Property Path, CookedValue 

You could also just gather all the Get-Counter results, then Select the CounterSamples, then perform a Select for Path, CookedValue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.