Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-13

API Reference

Command

Get-PowerShellCompatibility

Namespace PSPublishModule
Inputs
None

Analyzes PowerShell files and folders to determine compatibility with Windows PowerShell 5.1 and PowerShell 7+.

Remarks

Scans PowerShell files to detect patterns and constructs that can cause cross-version issues (Windows PowerShell 5.1 vs PowerShell 7+), and outputs a compatibility report. Use this as part of CI to keep modules compatible across editions, and pair it with encoding/line-ending checks when supporting Windows PowerShell 5.1.

Examples

Authored help example

Analyze a module folder

PS>


Get-PowerShellCompatibility -Path 'C:\MyModule'
        

Analyzes PowerShell files in the folder and returns a compatibility report.

Recursively analyze and include detailed findings

PS>


Get-PowerShellCompatibility -Path 'C:\MyModule' -Recurse -ShowDetails
        

Useful when investigating why a module behaves differently in PS 5.1 vs PS 7+.

Export compatibility findings to CSV

PS>


Get-PowerShellCompatibility -Path 'C:\MyModule' -ExportPath 'C:\Reports\compatibility.csv'
        

Creates a report that can be attached to CI artifacts.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Get-PowerShellCompatibility [-ExcludeDirectories <String[]>] [-ExportPath <String>] -Path <String> [-Recurse] [-ShowDetails] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

ExcludeDirectories String[] optionalposition: namedpipeline: False
Directory names to exclude from analysis.
ExportPath String optionalposition: namedpipeline: False
Export the detailed report to a CSV file at the specified path.
Path String requiredposition: namedpipeline: False
Path to the file or directory to analyze for PowerShell compatibility.
Recurse SwitchParameter optionalposition: namedpipeline: False
When analyzing a directory, recursively analyze all subdirectories.
ShowDetails SwitchParameter optionalposition: namedpipeline: False
Include detailed analysis of each file with specific compatibility issues found.