How PSRafScan Works
See how PSRafScan accepts a script, uses PowerShell's native parser, applies focused rules, and turns findings into a clear report.
1. Choose the input
Review an existing .ps1 file with -Path, or review the text currently on your clipboard with -Clipboard. Then choose whether the code will run as a saved script or be entered into a live terminal.
RSX -Path ./candidate.ps1 -IntendedUse Ps1File -FailOn Warning2. Parse the script
PSRafScan asks PowerShell's native parser for tokens, parse errors, and an abstract syntax tree. Syntax problems become PowerShellParseError findings with line and column details when available.
3. Apply focused rules
PSRafScan evaluates 58 rules for correctness, safety, portability, error handling, credentials, terminal paste behavior, and other common review concerns.
- Pattern rules inspect text at line or document scope.
- Token rules inspect PowerShell lexical tokens.
- AST rules inspect structured syntax-tree nodes.
- Hybrid rules combine more than one kind of analysis.
4. Review the report
Findings include the rule, severity, category, source location, matched text, issue, and recommended change. Choose PlainText for direct reading or Json for automation.
| Code | Status | Meaning |
|---|---|---|
0 | Pass | No finding met the selected threshold after parsing succeeded. |
1 | Fail | At least one rule finding met the selected threshold. |
2 | ParseError | PowerShell reported one or more syntax errors. |
Use the report as part of your review
PSRafScan performs static analysis. Use its findings alongside normal testing for the environment where the script will run.