I'd like to programmatically assemble and run a pipeline containing my own PSCmdlet. However, the Pipeline class only allows to add strings and Commands (which are constructed from strings in turn).
var runspace = ...;
var pipeline = runspace.CreatePipeline();
pipeline.AddCommand("Get-Date"); // ok
var myCmdlet = new MyCmdlet();
pipeline.AddCommand(myCmdlet); // Doesn't compile - am I fundamentally
// misunderstanding some difference between commands and commandlets?
foreach(var res in pipeline.Invoke()) {...}
I believe that what I'm doing should basically make sense... or is there a different way to do this?