PowerShell 7.6
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
1prompt
- PowerShell 7.6131 lines · 3.7K tokens
CWE Coverage
- 20
- 22
- 23
- 59
- 78
- 88
- 89
- 90
- 95
- 116
- 117
- 134
- 150
- 155
- 208
- 209
- 214
- 250
- 252
- 295
- 316
- 319
- 338
- 347
- 367
- 378
- 409
- 427
- 459
- 494
- 502
- 522
- 532
- 611
- 732
- 770
- 772
- 776
- 798
- 807
- 829
- 862
- 863
- 918
- 1104
- 1236
- 1333
- 1395
Prompt Preview
Use these rules for PowerShell 7.6 scripts, modules, automation, and remote administration that process untrusted data or perform privileged operations.
Trust and execution boundaries
- Treat execution policy as an accident-prevention feature, not as an authorization or sandbox boundary; it is not enforced on non-Windows systems.
- Run downloaded scripts only after verifying their source, signature or integrity, and intended version.
- Keep scripts and modules loaded by privileged automation non-writable by less-privileged identities.
- Use Windows App Control for Business in enforcement mode with constrained language where an actual code-execution boundary is required; setting
LanguageModealone is insufficient. - Do not weaken system-wide policy or language mode to make one script run.
Parsing and invocation
- Never pass untrusted text to
Invoke-Expression,ScriptBlock::Create, or another dynamic code parser. - Invoke commands with the call operator and a separated argument array when the command path is trusted.
- Check
$PSNativeCommandArgumentPassingbefore relying on that array. On Windows it defaults toWindows, which reverts to legacy string-joined argument parsing forcmd.exe, batch files, and a few other targets, where embedded quotes and empty arguments may not be preserved; do not pass untrusted text through batch-file command strings. - Use
Start-Process -ArgumentListonly after accounting for its native command-line rejoining and target-specific parsing. - Insert
--%or--only when the exact native program semantics are known;