title: Parameter equals none if not specified powershell
body: <p>I am trying to pass various parameters to a PowerShell script, however if no value is passed that script exits with an error. For example:</p>
  
  <pre><code>.powershellscript.ps1 -path C:\test -Name text.txt -Date 20111212
  </code></pre>
  
  <p>Works fine, however if I execute:</p>
  
  <pre><code>.powershellscript.ps1 -path C:\test -Name text.txt -Date
  </code></pre>
  
  <p>I receive the following error</p>
  
  <blockquote>
    <p>"Missing an argument for parameter 'Date'. Specify a parameter
    of type 'System.Object' and try again."</p>
  </blockquote>
  
  <p>I want to be able to assign the Date value to $Null if it's not passed through the script.</p>
  
  <p>Inside the .powershellscript.ps1, the parameters is handled as:</p>
  
  <pre><code>param(
      $path,
      $Name,
      $Date
  )
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>