> ## 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/PSUseCompatibleSyntax

> Use compatible syntax

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

| Property | Value |
| - | - |
| Severity | Warning |
| Category | PSScriptAnalyzer |
| Auto-fix | No |

## Description

This rule identifies syntax elements that are incompatible with targeted PowerShell versions.

It cannot identify syntax elements incompatible with PowerShell 3 or 4 when run from those
PowerShell versions because they aren't able to parse the incompatible syntaxes.

```powershell theme={null}
@{
    Rules = @{
        PSUseCompatibleSyntax = @{
            Enable = $true
            TargetVersions = @(
                '6.0',
                '5.1',
                '4.0'
            )
        }
    }
}
```

## Source

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


## Related topics

- [powershell/PSUseCompatibleCmdlets](https://tally.wharflab.com/rules/powershell/PSUseCompatibleCmdlets.md)
- [powershell/PSUseCompatibleCommands](https://tally.wharflab.com/rules/powershell/PSUseCompatibleCommands.md)
- [powershell/PSUseCompatibleTypes](https://tally.wharflab.com/rules/powershell/PSUseCompatibleTypes.md)
- [powershell/PSUseConstrainedLanguageMode](https://tally.wharflab.com/rules/powershell/PSUseConstrainedLanguageMode.md)
- [powershell/PSUseCmdletCorrectly](https://tally.wharflab.com/rules/powershell/PSUseCmdletCorrectly.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.