Private/Test-GetModule.ps1
<#
.SYNOPSIS Checks, whether specified module is loaded. #> function Test-GetModule { [CmdLetBinding()] [OutputType([bool])] param ( [Parameter(Mandatory = $true, HelpMessage = "Exact name of the mmodule")] [string] $Name, [Parameter(Mandatory = $false, HelpMessage = "Minimum required module version")] [Version] $RequiredVersion ) $ErrorActionPreference = 'Stop' $module = Get-Module -Name $Name -ea SilentlyContinue; #$module.version -ge $RequiredVersion return ($null -ne $module -and ([string]::IsNullOrEmpty($RequiredVersion) -or ( ` [Version]::new($ModuleInstalled.Version.Major, $ModuleInstalled.Version.Minor, $ModuleInstalled.Version.Build) ` -lt [Version]::new($FoundModule.Version.Major, $FoundModule.Version.Minor, $FoundModule.Version.Build)))) } |