How to access the output of a PowerShell script?

How to access PowerShell script output in Delphi?

I am looking for something similar to System.Management.Automation.PowerShell , but in native code.

To be more precise: I would like to process the objects PSObjectreturned by the PowerShell application.

I think since PowerShell is written in .NET, will I need to host the .NET platform in my Delphi application?

I saw a library called PowerShell Objects Delphi Edition on the component source, but the demo does not support XE2, and I cannot find the library on the manufaturers homepage.

Clarification : I'm not looking for a way to start PowerShell, CreateProcess works fine for this.

+5
source share
1 answer

You can create a C ++ / CLI wrapper around System.Management.Automation. * and set the entry point of the DLL, for example string ExecutePowerShellScript(string script). Then you will have no problem calling this DLL entry point from Delphi.

+1
source

All Articles