◐ Shell
clean mode source ↗

Change CommandInfo lookup for commands in the form `module\cmdletName` by liamjpeters · Pull Request #2125 · PowerShell/PSScriptAnalyzer

PR Summary

When the CommandInfoCache is used to lookup some fully qualified commands (by way of Get-Command), a nested module name is returned.

PR changes CommandInfoCache when a CommandInfo is looked up for a command in the form module\cmdletName. It passes this module name hint along to Get-Command to allow correct resolution.

With the MicrosoftTeams module installed, as an example, running:

Get-Command -Name 'MicrosoftTeams\Get-CsOnlineLisCivicAddress'

Reports the commands module as Microsoft.Teams.ConfigAPI.Cmdlets.

Instead running:

Get-Command -Name 'Get-CsOnlineLisCivicAddress' -Module 'MicrosoftTeams'

Correctly reports the module as MicrosoftTeams.

Also happens for Az.resources\Get-AzRoleEligibilitySchedule

Fixes #2123
Fixes #2023

PR Checklist