title: How do I determine if a PowerShell Cmdlet parameter value was specified?
body: <p>In PowerShell 1.0, if I have a cmdlet parameter of an enum type, what is the recommended method for testing whether the user specified that parameter on the cmdlet command line?  For example:</p>
  
  <pre><code>MyEnum : int { No = 0, Yes = 1, MaybeSo = 2 }
  
  class DoSomethingCommand : PSCmdlet
  ...
  private MyEnum isEnabled;
  
  [Parameter(Mandatory = false)]
  public MyEnum IsEnabled
  {
      get { return isEnabled; }
      set { isEnabled = value; }
  }
  
  protected override void ProcessRecord()
  {
      // How do I know if the user passed -IsEnabled &lt;value&gt; to the cmdlet?
  }
  </code></pre>
  
  <p>Is there any way to do this without having to seed isEnabled with a dummy value?  By default it will equal 0, and I don't want to have to seed every parameter or add a dummy value to my enum. I've potentially got <strong>many</strong> cmdlets with 100's of parameters, there's got to be a better way. This is related to <a href="https://stackoverflow.com/questions/727912/how-can-i-know-that-powershell-function-parameter-is-omitted">this question</a> but I was looking for a cleaner way of doing this.
  Thanks. </p>