I looked through several Questions and did not find anything similar to apply to my situation (from what I could say).
I have an x64 application (I cannot change the architecture to meet the design requirements) and it needs to call PowerShell Script in the x86 architecture.
var runspaceConfiguration = RunspaceConfiguration.Create(); var runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration); runspace.Open(); var pipeline = runspace.CreatePipeline(); var myCommand = new Command(@"MY-COMMAND"); myCommand.Parameters.Add("Path", @"C:\"); pipeline.Commands.Add(myCommand); return pipeline.Invoke();
If anyone can give me an idea of how I can start an x86-PowerShell session with C #, I would really appreciate it.
Edit: I will update this with the corrected code as soon as I remove the details.
source share