Finally, execute the commands in the pipeline and do something with the output:
Collection output = pipeline.Invoke();
foreach (PSObject psObject in output)
{
Process process = (Process)psObject.BaseObject;
Console.WriteLine(“Process name: ” + process.ProcessName);
}
foreach (PSObject psObject in output)
{
Process process = (Process)psObject.BaseObject;
Console.WriteLine(“Process name: ” + process.ProcessName);
}