Without forcing it powershell never outputs text. Therefor your not doing a line count. Instead you just ask pipeline a question. like..
Show me all process with more then one running instance?
gwmi win32_process | group-object name | ? { $_.count -gt 1}
Instead of me worrying about how to parse the data. I used the group-Object cmdlet to group process by name. The output of that cmdlet contains a count property.
If you knew exactly what process you where tageting you could also do this.
(gwmi win32_process -filter 'name="svchost.exe"').count
In that case the gwmi command is executed first with in the (). Since the -filter removed all but the process in question, you can use .count to count how many object were returned. Hope that helped...
-Glenn