CMD:
$errorRules = Get-ScriptAnalyzerRule -Severity Error,Warning
Invoke-ScriptAnalyzer -Path .\src\HyperVServer\HyperVServer\HyperVServer.ps1 -IncludeRule $errorRules -ExcludeRule PSAvoidUsingWriteHost
Output:
RuleName Severity ScriptName Line Message
PSUseShouldProcessForStateChangingF Warning HyperVServ 58 Function 'Set-HyperVCmdletDisabled' has verb that
unctions er.ps1 could change system state. Therefore, the function
has to support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 64 Function 'Set-HyperVCmdletEnabled' has verb that
unctions er.ps1 could change system state. Therefore, the function
has to support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 140 Function 'Start-HyperVVM' has verb that could change
unctions er.ps1 system state. Therefore, the function has to support
'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 261 Function 'Stop-VMUnfriendly' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 289 Function 'Stop-VMByTurningOffVM' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 314 Function 'Stop-HyperVVM' has verb that could change
unctions er.ps1 system state. Therefore, the function has to support
'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 390 Function 'New-HyperVSnapshot' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseShouldProcessForStateChangingF Warning HyperVServ 515 Function 'Remove-HyperVSnapshot' has verb that could
unctions er.ps1 change system state. Therefore, the function has to
support 'ShouldProcess'.
PSUseSingularNouns Warning HyperVServ 82 The cmdlet 'Get-VMExists' uses a plural noun. A
er.ps1 singular noun should be used instead.
PSUseSingularNouns Warning HyperVServ 111 The cmdlet 'Get-VMNames' uses a plural noun. A
er.ps1 singular noun should be used instead.
PSAvoidUsingWMICmdlet Warning HyperVServ 276 File 'HyperVServer.ps1' uses WMI cmdlet. For
er.ps1 PowerShell 3.0 and above, use CIM cmdlet which
perform the same tasks as the WMI cmdlets. The CIM
cmdlets comply with WS-Management (WSMan) standards
and with the Common Information Model (CIM)
standard, which enables the cmdlets to use the same
techniques to manage Windows computers and those
running other operating systems.