Get-Credential
noun
say it: “GET kruh-DEN-shul” /ˈɡɛt krəˈdɛnʃəl/
A PowerShell command that asks for a user name and password and hands them back together, with the password kept hidden.
What does Get-Credential do?
Get-Credential asks the person running the script for a user name and a password, and hands them back together as one object, a PSCredential. PowerShell 7 asks in the terminal and shows a star for each character; Windows PowerShell 5.1 opens a small sign-in window. Commands with a -Credential parameter take the object as it is.
$login = Get-Credential -UserName 'maple-street' -Message 'Sign in to the web host'
$login.UserName # maple-street
In a sentence
- “Get-Credential asked for the web host's password and showed only stars.”
- “Sam stored what Get-Credential returned in $login.”
Level: Journeyman · More PowerShell terms at this level
Updated