title: Add Windows Credentials using PowerShell & cmdkey
body: <p>I am trying to use credentials from some UI prompted to add Windows credentials using <em><a href="https://en.wikipedia.org/wiki/Management_features_new_to_Windows_Vista#Command-line_tools" rel="nofollow noreferrer">cmdkey</a></em>:</p>
  <pre><code>$sessionCredential = $host.ui.PromptForCredential(&quot;Need credentials&quot;, &quot;Please enter your user name and password.&quot;, &quot;&quot;, &quot;Server Crdentials&quot;)
  $ps = ConvertFrom-SecureString -SecureString $sessionCredential.password
  cmdkey.exe /add:server1 /user:$($sessionCredential.UserName) /pass:$($ps)
  </code></pre>
  <p>The credentials are added correctly, but the password is not.</p>
  <p><a href="https://i.stack.imgur.com/Eix88.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Eix88.png" alt="Enter image description here" /></a></p>
  <p>What can I do?</p>