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
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.