title: Remove unwanted values from the output values
body: <p>I wrote the following script to list the services of a particular application. It runs fine but the command used in the script writes some unwanted output apart from the actual values. I need to strip out these unwanted values and print only the data that I want.</p>
  
  <pre><code>$InfaPrm = Import-Csv 'D:\Tools\InfaRestart\infa_parm.csv'
  
  ForEach ($Params in $InfaPrm){
      $DOM = $Params.Domain
      $AdmUser= $Params.User
      $AdmPwd = $Params.Password
      $Security=$Params.SecurityDomain
      Set-Location -Path D:\Informatica\PowerCenter\isp\bin
      Invoke-Command -ScriptBlock {&amp; cmd.exe /c "infacmd.bat Listservices"  -dn "$DOM" -un "$AdmUser" -sdn "$Security" -st "IS"}
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>INT_SVC_TEST
  Command ran successfully.
  INT_SVC_FIN_TEST
  Command ran successfully.
  INT_SVC_MAN_TEST
  INT_SVC_HR_TEST
  INT_SVC_EM_TEST
  Command ran successfully.
  </code></pre>
  
  <p>I want to remove the string 'Command ran successfully.' from the above output and print only the service names.</p>