Automation · PowerShell Automation
PowerShell Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5254
Answer
Troubleshoot PowerShell scripts with Set-PSDebug, Write-Verbose and -Verbose, inspecting $Error[0] | Format-List * -Force, the execution policy, module versions and the PowerShell edition in use.
Remember
- Read full error record.
- Check edition and modules.
- Check execution policy.
First checks
$Error[0] | Format-List * -Force— error detailsSet-PSDebug -Trace 1— traceStart-Transcript -Path log.txt— capture session
Commands
$Error[0] | Format-List * -Force- Read-only/validation observation for the newest PowerShell ErrorRecord including exception, category, target object and…
Verify in this order
error → details → environment → fix → test
Where it usually breaks
Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.
PowerShell Troubleshooting · PowerShell operational reference
| Boundary | PowerShell Troubleshooting 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=5254