I'm trying to run this code:
using (PowerShell PowerShellInstance = PowerShell.Create())
{
_outputCollection.DataAdded += outputCollection_DataAdded;
PowerShellInstance.AddScript(@"workflow test { Write-Warning 'this is a warning'; }; test");
IAsyncResult result = PowerShellInstance.BeginInvoke<PSObject, PSObject>(null, _outputCollection);
}
But I get this error:
Windows PowerShell Workflow is not supported in a Windows PowerShe ll x86-based console. Open a Windows PowerShell x64-based console, and then try again.
How can I open a x64 based instance of Powershell from C#?