title: How to mask user input password in parameter of C# custom Cmdlet
body: <p>In my program I need to ask user for password in parameter:</p>
  
  <pre><code>[Cmdlet(VerbsCommon.Get, "MyTest"]
  public class GetMyTest : PSCmdlet
  {
      [Parameter(Mandatory=true)]
      public ? Password { get; set;}
  }
  </code></pre>
  
  <p>I can't figure out what is the correct type to use for Password. In another question:
  <a href="https://stackoverflow.com/questions/11174425/how-does-one-securely-handle-passwords-in-a-custom-written-powershell-cmdlet">How does one securely handle passwords in a custom written PowerShell cmdlet?</a></p>
  
  <p>The accepted answer asked to use read-host in the code, but I have to use parameter to ask for this field. </p>
  
  <p>I also tried to use SecureString for Password, but I am not able to give a SecureString to this parameter as it will be automatically accepted as string, not secure string.</p>
  
  <p>Is it any way to achieve the following usage:</p>
  
  <pre><code>Get-MyTest -Password ***** (where I actually type in 'abcde' but the input is masked.)
  </code></pre>