PSScriptAnalyzer:— ScriptAnalyzer is available for download from the PowerShell Gallery.

You are currently viewing PSScriptAnalyzer:— ScriptAnalyzer is available for download from the PowerShell Gallery.

PSScriptAnalyzer comes with a set of built-in rules that check for uninitialized variables, PS Credential Type usage, and Invoke-Expression usage, among other things. Additional features include the ability to exclude or add certain rules.

Invoke-ScriptAnalyzer analyses scripts or module files (.ps1,.psm1, and.psd1 files) against a set of best practise rules and returns rule violations as objects. Special rules for analyzing DSC resources are also included.

A set of built-in rules comes with Invoke-ScriptAnalyzer. It employs all rules by default. To pick the rules you want, utilize the Include Rule and Exclude Rule arguments. You can review and pick the rules you want to include or exclude from the evaluation using the Get-ScriptAnalyzerRule cmdlet.

Customized rules written in PowerShell scripts or compiled in C# assemblies can also be used. The IncludeRule and ExcludeRule parameters can also be used to select custom rules.

You can also include a rule in the analysis but disable its output for certain functions or scripts. This feature should only be utilised when absolutely essential. Run the command to get the rules that were suppressed.

Disclaimer: The intended use for the tool is strictly educational and should not be used for any other purpose.

Download Link: https://github.com/PowerShell/PSScriptAnalyzer

Leave a Reply