Powershell C# asynchronous execution

后端 未结 1 1421
攒了一身酷
攒了一身酷 2021-01-19 21:30

I want to execute a Powershell script asynchronously in C#. I\'ve used BeginInvoke method but I can\'t get the output/errors even though I\'ve attached delegate

相关标签:
1条回答
  • 2021-01-19 21:45

    See this answer. To actually run it asynchronously, you need to make your method asynchronous too. You can do that by calling Task.Factory.FromAsync(...) to get a Task<PSObject> for the asynchronous operation, then using await.

    0 讨论(0)
提交回复
热议问题