title: Is it possible to force PowerShell script to throw if a required parameter is omitted?
body: <p>I would like the second function call in this script to throw an error:</p>
  
  <pre><code>function Deploy
  {
  
  param(
  
      [Parameter(Mandatory=$true)]
      [ValidateNotNullOrEmpty()]
      [string]$BuildName
  
      )
      Write-Host "Build name is: $BuildName"
  
  }
  
  Deploy "Build123"
  
  Deploy #Currently prompts for input
  </code></pre>
  
  <p>Prompting is great for using the script interactively, but this will also be executed by our build server.</p>
  
  <p>Is my best bet just doing some custom validation with an <code>if</code> or something?</p>