Private/Get-specInstalledModuleVersion.ps1
|
function Get-specInstalledModuleVersion { <# .SYNOPSIS Retrieves all installed versions of a given PowerShell module. .DESCRIPTION Returns all versions of a module that are currently available in the system. This helps determine whether a module needs to be installed or updated. .PARAMETER ModuleName The name of the module. .OUTPUTS Array of ModuleInfo objects corresponding to installed versions. .EXAMPLE $installed = Get-specInstalledModuleVersion -ModuleName 'MyModule' .NOTES Author: owen.heaume Version: 1.0 - Initial release #> [CmdletBinding()] param ( [Parameter(Mandatory)] [string]$ModuleName ) Get-Module -ListAvailable -Name $ModuleName #| # Sort-Object Version -Descending | # Select-Object -First 1 } |