A module for selecting the credential stored in variables
- You need to have Windows PowerShell 5.1 or newer or PowerShell Core.
- Create one or more credentials object and store them in variables. You can also export them with Export-Clixml cmdlet and import them with Import-Clixml.
Install this Module from the PSGallery and Import the module
Install-Module SelectCredential
Import-Module SelectCredential
- Create one or more credentials object and store them in variables.
- Run the Select-Credential function and select one credential from menu.
- Run the Select-Credential as the parameter value in other cmdlets e.g. Enter-PSSession -ComputerName srv1.contoso.com -Credential (Select-Credential).
- Use the Cred alias for the Select-Credential function.
Different types of menus are displayed on different PowerShell hosts.
On Windows PowerShell console and PowerShell Core console credential can be selected using the up and down arrows, then pressing enter.
On other hosts, the credential can be chosen by entering number, then pressing enter.