title: powershell mandatory parameter with default value shown
body: <p>I am looking for a way to have an PowerShell script ask for an parameter which needs to be mandatory, but shown with an default value, e.g.:</p>
  
  <pre><code>    .\psscript
      Supply values for the following parameters:
      parameter1[default value]:
      parameter2[1234]:
  </code></pre>
  
  <p>I want to ask for input but provide some default values.</p>
  
  <p>If I use the mandatory option it asks for the values nicely but doesn't show the default value or process the given value.  If I don't make it mandatory then PowerShell doesn't ask for the value at all.</p>
  
  <p>Here's some script examples I tried:</p>
  
  <pre><code>    [CmdletBinding()]
      Param(
          [parameter(Mandatory=$true)] $SqlServiceAccount = $env:computername + "_sa",
          [parameter(Mandatory=$true)] $SqlServiceAccountPwd
      )
  </code></pre>
  
  <p>This script asks for parameters but does not show or process the default value if I just press enter on the first parameter.</p>
  
  <pre><code>    [CmdletBinding()]
      Param(
          [parameter(Mandatory=$false)] $SqlServiceAccount = $env:computername + "_sa",
          [parameter(Mandatory=$true)] $SqlServiceAccountPwd
      )
  </code></pre>
  
  <p>This script doesn't ask for the first parameter, but processes the default value.</p>