Is there a way to do this PowerShell statement in C#
$myvariable = New-PSSessionOption -SomeParameter -AnotherParameter -YetAnotherParameter
I know how to run commands and add parameters (PowerShell.AddCommand etc), but I'm missing something that lets me do an entire statement.
The docs do suggest there is an 'AddStatement' method on the PowerShell class, but it's not there in reality.
Or am I better just putting it all in a script and just calling that from my C# instead?
Thanks