title: PowerShell ValidateSet on Boolean Parameter
body: <p>I am attempting to use ValidateSet with a boolean parameter however I cannot get it to function as expect.</p>
  
  <p>An example to replicate the issue:</p>
  
  <pre><code>function Set-Boolean
  {
      [CmdletBinding()]
      [OutputType([Bool])]
      Param
      (
          [Parameter(Mandatory=$true, Position=0)]
          [ValidateNotNullOrEmpty()]
          [ValidateSet($false,$true)]
          [Bool] $Bool
      )
  
      Process
      {
          $Bool
      }
  }
  </code></pre>
  
  <p>At run time PowerShell expands the <code>$true</code> and <code>$false</code> variables upon tab completion to <code>True</code> and <code>False</code> respectively however this then cause the parameter validation to fail as only <code>$true</code>, <code>$false</code>, <code>1</code> and <code>0</code> are valid boolean types.</p>
  
  <p>I tried changing ValidateSet to <code>[ValidateSet('$false','$true')]</code> and the tab completion works as expected however the parameter validation still fails as the parameter is expecting the strings <code>'$false'</code> and <code>'$true'</code>.</p>
  
  <p>I could change ValidateSet to <code>[ValidateSet([bool]0,[bool]1)]</code> and have it function as I expect but I find <code>0</code> and <code>1</code> a poorer user experience over <code>$true</code> and <code>$false</code> for completion of a boolean parameter.</p>
  
  <p>The expected output of the function should be <code>True</code> when <code>$true</code> is chosen and <code>False</code> when <code>$false</code> is chosen.</p>
  
  <p>I have implemented a workaround in my code but I want to know how I can use ValidateSet with a boolean parameter, if it is possible, to enable the use of tab completion for the user.</p>