Skip to content

Get ModuleByVersion

viscalyxbot edited this page Feb 26, 2025 · 1 revision

Get-ModuleByVersion

SYNOPSIS

Gets a specific version of a PowerShell module from the list of available modules.

SYNTAX

Get-ModuleByVersion [-Name] <String> [-Version] <String> 
 [<CommonParameters>]

DESCRIPTION

The Get-ModuleByVersion function retrieves a specific version of a PowerShell module from the list of available modules based on the module name and version provided. If the module with the specified version is found, it returns the module object; otherwise, it returns $null.

EXAMPLES

EXAMPLE 1

Get-ModuleByVersion -Name 'MyModule' -Version '1.0.0'

Retrieves the module 'MyModule' with version '1.0.0' and returns the module object.

PARAMETERS

-Name

The name of the module to retrieve.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Version

The version of the module to retrieve.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None. You cannot pipe input to this function.

OUTPUTS

[PSModuleInfo] or $null

The function returns a PSModuleInfo object if the module with the specified

name and version is found; otherwise, it returns $null.

NOTES

RELATED LINKS

Clone this wiki locally