jdhitsolutions / PSScriptTools

:wrench: :hammer: A set of PowerShell functions you might use to enhance your own functions and scripts or to facilitate working in the console. Most should work in both Windows PowerShell and PowerShell 7, even cross-platform. Any operating system limitations should be handled on a per command basis. The Samples folder contains demonstration script files
MIT License
901 stars 112 forks source link

Get prefixed cmdlets #113

Closed cdhunt closed 1 year ago

cdhunt commented 3 years ago

It looks like this is only an issue for binary cmdlets and ToString() on the CmdletInfo object returns the prefixed command name.

Fixes #112

jdhitsolutions commented 3 years ago

This doesn't work on exported functions in PowerShell 7. The only way Get-ModuleCommand works as expected in PowerShell 7 is if you first import the module so that the prefix is applied.

cdhunt commented 3 years ago

The prefix can be pulled from $mod.prefix and I guess some string formatting can be done where $PSVersionTable.PSVersion -ge 7.0?

jdhitsolutions commented 3 years ago

Since Microsoft agrees there is a PowerShell 7 bug, I'm going to hold off on doing anything. This is only an issue when using -ListAvailable in PowerShell 7. This isn't a problem if the module has been imported with the prefix first.

jdhitsolutions commented 1 year ago

Ignoring the issue for now, and this PR is so far out of alignment with the current state of the project with too many merge conflicts to manage.