Chapters/analyzing-your-script/snippets.ps1

# install module
install-module psscriptanalyzer



# assumes you're in sample code folder
Invoke-ScriptAnalyzer .\Script.ps1



# replace Param() block in script with:
    Param(
        [Parameter(ValueFromPipeline=$True,
                   Mandatory=$True)]
        [Alias('CN','MachineName','Name')]
        [string[]]$ComputerName,
        
        [string]$LogFailuresToPath,

        [ValidateSet('Wsman','Dcom')]
        [string]$Protocol = "Wsman",

        [switch]$ProtocolFallback,

        [string]$Password
    )



# try again
Invoke-ScriptAnalyzer .\Script.ps1