title: Trying to get the number of process count using PowerShell
body: <p>I am trying to get no.of process count to be displayed. The condition is I have a parent process ID and child process I was able to retrieve and display the parent and child process but I want to display the count of child process pertaining to the parent process.</p>
  
  <p>Please find the piece of script that I have put it in.</p>
  
  <pre class="lang-bsh prettyprint-override"><code>Write-Host "ADS services with Java processes"
  Invoke-Command -Computer SM06388.dom1.e-ssi.net -ScriptBlock {
      Get-WmiObject -Class Win32_Service -Filter "name='OpenLink_ADS_Fenix_PCT'"
  } | ForEach-Object {
    if ($_.State -eq "running") {
      Write-Host $_.PSComputerName $_.Name $_.State $_.StartMode -  ForegroundColor green
      Get-WmiObject -Class Win32_Process -Filter "Name='java_svc_wrapper.exe'" | ForEach-Object {
        Get-WmiObject Win32_Process -Filter  "ParentProcessId=$($_.ProcessId)"
      } | Format-Table ProcessName,ProcessId,Handle,ParentProcessId -Auto
    } else {
      Write-Host $_.PSComputerName $_.Name $_.State $_.StartMode -ForegroundColor red
    }
  }
  </code></pre>
  
  <p>The output that I get with the script is pasted below</p>
  
  <pre>ADS services with Java processes
  sm06388.dom1.e-ssi.net OpenLink_ADS_FENIX_PCT Running Auto
  
  ProcessName ProcessId Handle ParentProcessId
  ----------- --------- ------ ---------------
  java.exe        12164 12164             5520
  java.exe         9392 9392              5520
  java.exe        12892 12892             5520
  java.exe        10396 10396             5520
  java.exe         9868 9868              5520
  java.exe        11584 11584             5520
  java.exe        14760 14760             5520
  java.exe         9740 9740              5520
  java.exe        12232 12232             5520
  java.exe        16432 16432             5520
  java.exe        15688 15688             5520</pre>
  
  <p>Here I am trying to just display the count of the process. Can anyone help me how to get this count displayed.</p>