Get-Credential
SafePrompt for credentials
$cred = Get-Credential
Prompts securely and feeds -Credential parameters — the standard way to avoid hard-coded passwords.
Examples
Invoke-Command -ComputerName srv01 -Credential (Get-Credential) -ScriptBlock { hostname }Run remotely as another user
Syntax
Get-Credential [user] → -Credential $credで利用
Before you run it
Prompt only; never store plaintext.
Related commands
- runasRun as another user
- Invoke-CommandRun commands remotely
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store