title: Powershell Inconsistency string
body: <pre><code>$ServName = &quot;&quot; 
  
  $UnnecessaryService = get-service
  
  $UnnecessaryService | Out-File &quot;UnnecessaryServices.txt&quot;
  
  $UnnecessaryService = gc UnnecessaryServices.txt | Select-String &quot;CryptSvc&quot;
  
  $UnnecessaryService = Out-String -InputObject $UnnecessaryService
  
  $UnnecessaryService = $UnnecessaryService.Split(' ')
  
  $UnnecessaryService = $UnnecessaryService[0]
  
  $NowName = &quot; Cryptographic Services&quot;
  write $UnnecessaryService
  
  if ($UnnecessaryService -eq &quot;Running&quot;)
  {
      $ServName = $ServName + $NowName
      write $ServName
  }
  else
  {
      $result = &quot;good&quot;
      write $result
  }
  </code></pre>
  <p>I think this codes output must be <code>$ServName</code> but it's printed <code>$result</code>.
  So I find out what is the problem.</p>
  <p>Then <code>$UnnecessaryService</code> has link break.
  The bottom line is i want <code>$UnnecessaryService -eq &quot;Running&quot;</code> is correct code. Help me guys.</p>
  <p>The contents of <strong>UnnecessaryServices.txt</strong> is:</p>
  <pre><code>Status   Name               DisplayName                           
  ------   ----               -----------                                         
  Running  CryptSvc           Cryptographic Services                
  </code></pre>