private/Test-PwshVersionMin.ps1
|
function Test-PwshVersionMin { <# .SYNOPSIS Tests whether the current PowerShell version is 7.4 or later .DESCRIPTION Compares PSVersionTable.PSVersion with System.Version 7.4. Returns $true when the current process meets or exceeds that version; otherwise, returns $false. This function does not inspect other PowerShell installations on disk. .EXAMPLE PS> Test-PwshVersionMin Tests whether the current PowerShell process is version 7.4 or later. .INPUTS None. This function does not accept pipeline input. .OUTPUTS System.Boolean. Returns $true when the current PowerShell version is 7.4 or later; otherwise, returns $false. .NOTES Author: David Segura Company: Recast Software Version: 1.0.0 Date: 2026-08-28 #> [OutputType([bool])] param () $minVersion = [System.Version]'7.4' return ($PSVersionTable.PSVersion -ge $minVersion) } |