프로그래밍 방식으로 어셈블하고 내 자신의 PSCmdlet을 포함하는 파이프 라인을 실행하고 싶습니다. 그러나 Pipeline 클래스는 문자열과 명령 (차례대로 문자열로 구성) 만 추가 할 수 있습니다.프로그래밍 방식으로 PSCmdlet을 Powershell 파이프 라인에 추가하는 방법?
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()) {...}
나는 내가하고있는 일은 근본적으로 의미가 있어야한다고 생각한다. 아니면 다른 방법이 있을까?