Q. How can I make PowerShell prompt for alternate credentials?
To make PowerShell prompt for alternate credentials, run something like a Get-Credential command. Click here for more details.
Don Jones
July 20, 2010
1 Min Read
Q. How can I make PowerShell prompt for alternate credentials?
A. To make PowerShell prompt for alternate credentials, run something like
$cred = Get-Credential username
Doing so will prompt for the credential and store the results in the $cred variable for future use. Note that there's no way to provide the password via the command line, and there's really no secure way to permanently store a username/password combo. (Yes, you could encrypt it, but to read it back in you'd be hard-coding the decryption key, so what's the point?)
Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like