private/Test-CommandPwsh.ps1
|
function Test-CommandPwsh { <# .SYNOPSIS Tests whether PowerShell 7 is available in the current session PATH .DESCRIPTION Uses command discovery to locate pwsh in the current session PATH. Returns $true when the command is found; otherwise, returns $false. This function does not verify that pwsh can execute or inspect installed applications outside PATH. .EXAMPLE PS> Test-CommandPwsh Tests whether the pwsh command is available in the current session PATH. .INPUTS None. This function does not accept pipeline input. .OUTPUTS System.Boolean. Returns $true when pwsh is found; otherwise, returns $false. .NOTES Author: David Segura Company: Recast Software Version: 1.0.0 Date: 2026-08-28 .LINK Test-InstallPwsh #> [OutputType([bool])] param () return ($null -ne (Get-Command -Name 'pwsh' -ErrorAction SilentlyContinue)) } |