You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Import-Module validate compatible operating systems #9784
There are cases when a module only works on a specific operating systems. Today module authors can tag a module in PSGallery stating which OS is supported. However, there is no enforcement from PowerShell itself to prevent a user from importing an incompatible module.
This request also goes along with #3751 to add support for #requires -OS.
PowerShell 7 would be the best time to release this functionality.
Add CompatibleOS field in the PSD1 with valid values of Windows, MacOS, and Linux. Then Import-Module can be updated use that field to prevent importing an incompatible module.
Hi @tnieto88, Do you think just specifying Window/Linux/Mac is enough or do you see a need for more detail? What about OS version? For example, the new Windows "terminal" requires the latest update (1903 IIRC.) And then there are all the different Linux distros. The tricky bit of course is getting that detailed information since "uname -a" doesn't return the distro name or version.
(On a related note; on Windows there is already the CompatiblePSEditions field for Desktop and Core that is (now) enforced).
Hello Bruce Payette (@BrucePay), I think the current level of detail is fine. The values align with the automatic variables and with RFC#35. As for OS version I personally haven't had a need yet to specify a minimum version.
This to me feels like there needs to be an addition to the properties available in the psd1 that accompanies a module that add's at least simple OS values. However this needs to be done with caution as it likely will break down compatibility again like CompatiblePSEditions did
I agree adding a new PSD1 field that prevents importing on earlier versions is not ideal and would hurt adoption. Since PowerShellGet is getting rewritten with PS7 I mentioned in PowerShell/PowerShell-RFC#185 that may be good to move the built-in module (*-Module) commands to PowerShellGet. This would allow older PS versions to make use of enhancements and import any new PSD1 fields.
When this change is made, built-in *-Module commands should be updated to support semver as well as [System.Version] (for backwards compatibility). If the built-in commands are updated that brings up a question about how will older versions of PowerShell handle that. There are issues with the current paradigm of trying to force semver into a system that doesn't support it. We get issues like PowerShell/PowerShellGet#324 and PowerShell/PowerShellGet#204.
What will be the minimum PS version supported for PowerShellGet v3? If it's less than PS 7 then it may be worth breaking out the built-in *-Module commands from PowerShell into PowerShellGet to add support for semver in older PS versions.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commented on Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
Activity
BrucePay commentedon May 31, 2019
Hi @tnieto88, Do you think just specifying Window/Linux/Mac is enough or do you see a need for more detail? What about OS version? For example, the new Windows "terminal" requires the latest update (1903 IIRC.) And then there are all the different Linux distros. The tricky bit of course is getting that detailed information since "uname -a" doesn't return the distro name or version.
(On a related note; on Windows there is already the CompatiblePSEditions field for Desktop and Core that is (now) enforced).
ThomasNieto commentedon May 31, 2019
Hello Bruce Payette (@BrucePay), I think the current level of detail is fine. The values align with the automatic variables and with RFC#35. As for OS version I personally haven't had a need yet to specify a minimum version.
kilasuit commentedon Jun 2, 2019
This to me feels like there needs to be an addition to the properties available in the psd1 that accompanies a module that add's at least simple OS values. However this needs to be done with caution as it likely will break down compatibility again like CompatiblePSEditions did
ThomasNieto commentedon Jun 3, 2019
I agree adding a new PSD1 field that prevents importing on earlier versions is not ideal and would hurt adoption. Since PowerShellGet is getting rewritten with PS7 I mentioned in PowerShell/PowerShell-RFC#185 that may be good to move the built-in module (
*-Module) commands to PowerShellGet. This would allow older PS versions to make use of enhancements and import any new PSD1 fields.microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 16, 2023
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.
microsoft-github-policy-service commentedon Nov 23, 2023
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.