Using PSScriptAnalyzer to check PowerShell version compatibility
devblogs.microsoft.com
PSScriptAnalyzer version 1.18 was released recently, and ships with powerful new rules that can check PowerShell scripts for incompatibilities with other PowerShell versions and environments.