> ## Documentation Index
> Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# powershell/PSReservedParams

> Reserved Parameters

`powershell/PSReservedParams` is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.

| Property | Value             |
| -------- | ----------------- |
| Severity | Error             |
| Category | PSScriptAnalyzer  |
| Default  | Disabled in tally |
| Auto-fix | No                |

<Note>
  tally disables this rule by default for Dockerfile `RUN` snippets because a `RUN` executes
  statements inline rather than defining cmdlets, parameters, or modules with external callers. Re-enable it with
  `include = ["powershell/PSReservedParams"]` or by setting
  `rules.powershell.PSReservedParams.severity = "warning"` in `.tally.toml`.
</Note>

## Description

You can't redefine [common parameters][01] in an advanced function. Using the `CmdletBinding` or
`Parameter` attributes creates an advanced function. The common parameters are are automatically
available in advanced functions, so you can't redefine them.

## How

Change the name of the parameter.

## Examples

### Problematic code

```powershell theme={null}
function Test
{
    [CmdletBinding()]
    Param
    (
        $ErrorVariable,
        $Parameter2
    )
}
```

### Correct code

```powershell theme={null}
function Test
{
    [CmdletBinding()]
    Param
    (
        $Err,
        $Parameter2
    )
}
```

[01]: /powershell/module/microsoft.powershell.core/about/about_commonparameters

## Source

This rule documentation is adapted from Microsoft's PSScriptAnalyzer documentation for
[ReservedParams](https://github.com/MicrosoftDocs/PowerShell-Docs-Modules/blob/main/reference/docs-conceptual/PSScriptAnalyzer/Rules/ReservedParams.md),
licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
