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 and flow from this site, held on your device and searchable with no connection. Free to install, no ads.
Get it free on the App Store