title: How do I put a boolean result into a variable in Powershell?
body: <p>If I've got a variable $count with a number in it, is there a one-liner to set a variable to either true or false depending on whether $count = 1?</p>
  
  <p>I thought that</p>
  
  <pre><code>$result = ($count -eq 1)
  </code></pre>
  
  <p>would do it, but I end up with a value of "1" or null stored in it (depending on whether it's 1 or not).</p>
  
  <p>Any idea what I'm doing wrong?</p>
  
  <p>EDIT: My Mistake - I didn't actually have "1" in that variable.  I had an ArrayList that <em>looked</em> like it was the number 1.  Closing this.</p>
  
  <p>Full code:</p>
  
  <pre><code>get-acl C:\Windows\System32\drivers\etc | select -expand access | where {$_.IdentityReference -eq "SomeACL"} | measure | select -expand count -OutVariable aclCount
  $aclFound = ($aclCount –eq 1)
  $TodayDate = Get-Date -Format "dd/MM/yyyy hh:mm:ss"
  Add-Content f:\myfile.log "$TodayDate $aclFound "
  </code></pre>
  
  <p>Fixed it by putting a [0] after the $aclCount on line 2.
  (Obviously the ACL in there was the one I was checking for)</p>