Automation · PowerShell Automation
Credentials
Cheat sheet · https://pcornel.dk/topic.php?topic=5248
Answer
PowerShell credentials are PSCredential objects created with Get-Credential or from SecretManagement, passed to -Credential parameters. Never hard-code passwords in scripts.
Remember
- Use PSCredential objects.
- Get from SecretManagement or Get-Credential.
- Never hard-code passwords.
First checks
Get-Credential— interactive prompt- PSCredential from SecretManagement — stored securely
- No plaintext passwords in scripts — security
Verify in this order
secret store → PSCredential → cmdlet
Where it usually breaks
Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.
Credentials · PowerShell operational reference
| Boundary | Credentials reference |
|---|---|
| Runtime identity | PowerShell edition/version + command/module source |
| Persistent intent | Script/module/config prerequisites under source control |
| Verification | Read-only discovery → execution evidence → independent target read-back |
| Output contract | Structured objects/streams before formatting |
| Failure boundary | Separate engine/binding from transport/API/native and target-state failures |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5248