get-service | foreach \{$t=0\} \{$t +=1\} \{"Total services: $t"\} A number of readers pointed out that I should've used the Measure-Object cmdlet with the following commands:
get-service | measure-object | select count The output would be:
Count<br> -----<br> 152 If I hadn't included the | select count command, the computer would have outputted other counts that don't apply to what I wanted, such as information about averages, sums, maximums, and minimums of the values passed.



