Search code examples
powershell

How to find the target PowerShell version of a module not yet installed?


I can query a module I want to install using

Find-Module -Name AzureAD

However, I must know beforehand that this module can only be installed in PowerShell v5/Desktop and not PowerShell v7/Core, otherwise I might install it or try to run it in the wrong version and get all sorts of issues.

Apparently it should be possible to find this information using the 'Tag' property:

Find-Module -Tag PSEdition_Desktop
Find-Module -Tag PSEdition_Core

https://learn.microsoft.com/en-us/powershell/gallery/concepts/module-psedition-support?view=powershellget-3.x

However, it doesn't seem to work (perhaps the module authors do not bother filling in this value).

Is there any way to find the target PowerShell version of a module before installing it?


Solution

  • I think you can use the Find-Module command and use the AdditionalMetadata property.

    AdditionalMetadata

    But I think this could be the same result as your -Tag thing.