Skip to content

Get-Module accepts nonsensical combinations of ModuleVersion and MaximumVersion entries for -FullyQualifiedName #7337

@mklement0

Description

@mklement0

Steps to reproduce

Request a minimum version of 1.6.0 and - nonsensically - a maximum version of 1.5.0:

Get-Module -ListAvailable -FullyQualifiedName @{ ModuleName='PowerShellGet'; ModuleVersion='1.6.0'; MaximumVersion='1.5.0' }

Expected behavior

I think a statement-terminating error indicating that MaximumVersion must be greater or equal to ModuleVersion (which uses minimum logic) would be more helpful than the current behavior.

If feasible, this validation should be tied to fully qualified module names themselves, wherever they are accepted.

Actual behavior

The argument is quietly accepted and therefore results in no output (because, by definition, no modules match).

Environment data

PowerShell Core v6.1.0-preview.3 on macOS 10.13.6
PowerShell Core v6.1.0-preview.3 on Ubuntu 16.04.4 LTS
PowerShell Core v6.1.0-preview.3 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.165)
\Windows PowerShell v5.1.17134.165 on Microsoft Windows 10 Pro (64-bit; Version 1803, OS Build: 17134.165)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions