title: Functions Returns Boolean in PowerShell
body: <p>I use PS Remoting , Powershell 2.0.</p>
  
  <p>I need call to Functions that returns boolean value ($true or $false).</p>
  
  <p>My function:</p>
  
  <pre><code>Function TryDisableClientForCredSSP()
  {
      try 
      {
          WriteTrace "[TryDisableClientForCredSSP]. Disable-WSManCredSSP -Role Client "
          $script=Convert-StringToScriptBlock("Disable-WSManCredSSP -Role Client ")
          Caller($script)
  
          WriteTrace "[TryDisableClientForCredSSP]. winrm get winrm/config/client/auth [($env:COMPUTERNAME)]"
          $script=Convert-StringToScriptBlock("winrm get winrm/config/client/auth")
          Caller($script);
  
          return $true;
      }
      catch 
      {
          Write-Verbose "[TryDisableClientForCredSSP] Error "
          Write-Verbose $_
          Write-Host $_.Exception.Message`r`n
          return $false;
      }   
  }
  </code></pre>
  
  <p>note: WriteTrace  function just only do Write-Host.</p>
  
  <p>I use it:</p>
  
  <pre><code>    $ok = TryDisableClientForCredSSP;
      WriteTrace   "[TryDisableClientForCredSSP]. $ok"
      if ($ok -eq $true)
      {
          WriteTrace "[TryDisableClientForCredSSP]. OK true"
      }
      else
      {
          WriteTrace "[TryDisableClientForCredSSP]. KO false"
      }
  </code></pre>
  
  <p>I get this output:</p>
  
  <pre><code>[TryDisableClientForCredSSP]. Auth     Basic = true     Digest = true     Kerberos = true     Negotiate = true     Certificate = true     CredSSP = false  True
  [TryDisableClientForCredSSP]. OK true
  </code></pre>
  
  <p>I want that this line outputs "[TryDisableClientForCredSSP]. True"</p>
  
  <pre><code> WriteTrace   "[TryDisableClientForCredSSP]. $ok"
  </code></pre>
  
  <p>Any suggestions ?</p>