Having the following NET 5 Console application:
static void Main(string[] args)
{
using var ps = PowerShell.Create();
// ps.AddCommand("Get-Service");
ps.AddStatement().AddCommand("Get-Service");
ps.Invoke();
}
The calls seems to be executed with no error, but where the output goes?
I've tried both AddCommand
and AddStatement
, and also examined the ps
variable in debugger, no signs of output. I did discover the ps.Streams.Information
but it is empty.