Closed cdhunt closed 1 year ago
After poking around ExportedCommands
for a few minutes I can't track down what is generating the name with prefix. The prefix or prefixed name doesn't seem to be in CmdletInfo
. Pesky FormatData.
What version of PowerShell are you running this under? I modified a module to use a default prefix and this works in 5.1.
It also works in PS 7 if the module is loaded
But there is a problem if it isn't loaded.
But only in PowerShell 7. Windows PowerShell works fine.
Yeah, I'm running in 7.
This looks like a PowerShell 7 bug with Get-Module
. Investigating.
Microsoft agrees that this is a bug in PowerShell 7. The workaround for us appears to be first import the module then run Get-ModuleCommand
.
This is still a bug in PowerShell 7.2.
Is this still an issue for you? It has been a while since this was opened.
I'm not currently using this module. I can't say.
I think I'm going to close the issue then. We can always re-open it or start anew.
Is your feature request related to a problem? Please describe. I have a module that uses a DefaultCommandPrefix to disambiguate from built-in cmdlet names. Get-ModuleCommand operates on the key which is the command name before applying the prefix. This causes it to query info on the built-in command versus my command.
Example:
DefaultCommandPrefix = 'my'
New-Service
vsNew-myService
I want info on
New-myService
Describe the solution you'd like If
Key -ne Value
, useValue
in Get-ModuleCommand.ps1#L53Describe alternatives you've considered I don't see anywhere that
DefaultCommandPrefix
is exposed to the runtime so you can programmatically check.I believe you could also always just use Value instead of Key.
Additional context