qshinoの日記

Powershell関係と徒然なこと

PSScriptAnalyzer for PowerShell

PSScriptAnalyzer for PowerShell

使い方

Invoke-ScriptAnalyzer SCRIPT

使うまで

Download from GitHub

    Install-Module -Name PSScriptAnalyzer
    or
    git clone https://github.com/PowerShell/PSScriptAnalyzer
    or
    download from https://github.com/PowerShell/PSScriptAnalyzer/releases
  1. PS5.1以降の場合

    Install-PackageProvider Nuget –force –verbose Exit

  2. 導入確認

    Get-ScriptAnalyzerRule

  3. 実行

    Invoke-ScriptAnalyzer SCRIPT

Usage

Get-ScriptAnalyzerRule [-CustomizedRulePath <string[]>] [-Name <string[]>] [<CommonParameters>] [-Severity <string[]>]

Invoke-ScriptAnalyzer [-Path] <string> [-CustomizedRulePath <string[]>] [-ExcludeRule <string[]>] [-IncludeRule <string[]>] [-Severity <string[]>] [-Recurse] [<CommonParameters>]

参考

GitHub

Readme

https://github.com/PowerShell/PSScriptAnalyzer/blob/development/README.md

GiHub Root https://github.com/PowerShell/PSScriptAnalyzer

TechNet

https://technet.microsoft.com/ja-jp/library/dn927161.aspx

https://msdn.microsoft.com/ja-jp/powershell/scripting/core-powershell/core-modules/psscriptanalyzer-module