PowerShell’s Get-Credential cmdlet lets us create a secure credential object for a specified user name and password using a UI dialog:
1
| PS> Get-Credential shay |
1
2
| $key = "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds"Set-ItemProperty -Path $key -Name ConsolePrompting -Value $true |
1
2
3
4
5
| PS> Get-Credential shayWindows PowerShell Credential RequestEnter your credentials.Password for user shay: ******** |