PowerShell / PowerShell/PSScriptAnalyzer

`PSUseCompatibleCmdlets` says `Install-Module` is not compatible with `desktop-5.1.14393.206-windows`

Open
#2,052 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue - Bug
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Steps to reproduce

Invoke-ScriptAnalyzer -ScriptDefinition 'Install-Module -Name ''Foo''' -Settings @{
    Rules = @{
        PSUseCompatibleCmdlets = @{
            Compatibility = @('desktop-5.1.14393.206-windows')
        }
    }
} | Format-List -Property '*'

Expected behavior


Actual behavior

Line                 : 1
Column               : 1
Message              : 'Install-Module' is not compatible with PowerShell edition 'desktop', version '5.1.14393.206' and OS 'windows'
Extent               : Install-Module
RuleName             : PSUseCompatibleCmdlets
Severity             : Warning
ScriptName           : 
ScriptPath           : 
RuleSuppressionID    : 
SuggestedCorrections : 
IsSuppressed         : False

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

  • PowerShell v7.4.6 x64 on Windows 11 24H2 x64
  • PSScriptAnalyzer v1.23.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied PowerShell reproduction and inspect the PSUseCompatibleCmdlets rule and its compatibility lookup for Install-Module. Verify the command's reported compatibility result and determine the intended result for the desktop-5.1.14393.206-windows target; the issue is resolved when the rule reports the correct result and the reproduction is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.