Evotec

Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 43
Forks 13
Open issues 1
PowerShell Gallery downloads 13,876
Release v3.0.3
Language: C# Updated: 2026-04-14

API Reference

Cmdlet

Get-PowerShellCompatibility

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

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>] [-Internal] -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.
Internal SwitchParameter optionalposition: namedpipeline: False
Internal mode used by build pipelines to suppress host output.
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.

Outputs

System.Object