Provide/document an official way to run a PSCmdlet from another PSCmdlet
See original GitHub issueSummary of the new feature / enhancement
There’s an official article describing how to invoke a Cmdlet
from another cmdlet: https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/how-to-invoke-a-cmdlet-from-within-a-cmdlet?view=powershell-7.2
However, it does not describe any way to do the same for PSCmdlet
, which I believe is a much more common request, given that most of builtin cmdlets inherit from PSCmdlet
. On Stack Overflow, one can find guides how to do that, but at least some of them are either wrong, or grossly inefficient (e.g. spawning a new PowerShell
instance just to run a single cmdlet).
I’d appreciate an official documentation on how to invoke PSCmdlet
-deriving cmdlets, and ideally a new, discoverable, type-safe method on PSCmdlet
to do that without extra workarounds.
Proposed technical implementation details (optional)
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Nah it throws at runtime for
PSCmdlet
. The only way to invoke another command from a binary cmdlet is with theSMA.PowerShell
APIAh ok, good to know, did not realise that was the case