Edit

ReservedParams

Severity Level: Error

Description

This rule detects when you attempt to redefine common parameters in an advanced function. When you use the CmdletBinding or Parameter attributes, you're creating an advanced function. Common parameters are automatically available in advanced functions, so you can't redefine them. If you're trying to use a parameter name that conflicts with a common parameter, you need to change the name of your parameter to something else.

Example

Noncompliant

function Test
{
    [CmdletBinding()]
    Param
    (
        $ErrorVariable,
        $Parameter2
    )
}

Compliant

function Test
{
    [CmdletBinding()]
    Param
    (
        $Err,
        $Parameter2
    )
}