PowerShell PSScriptAnalyzer - PowerShell Script Analyzer Analyzing scripts against every built-in rule


Example

To run the script analyzer against a single script file execute:

Invoke-ScriptAnalyzer -Path myscript.ps1

This will analyze your script against every built-in rule. If your script is sufficiently large that could result in a lot of warnings and/or errors.

To run the script analyzer against a whole directory, specify the folder containing the script, module and DSC files you want analyzed. Specify the Recurse parameter if you also want sub-directories searched for files to analyze.

Invoke-ScriptAnalyzer -Path . -Recurse