Search code examples
powershellparametersexeoutput-redirect

Returning data from .Net EXE to Powershell


I have a powershell script that calls an executable to do some data crunching and the script needs to retrieve the results from by the executable file. Wondering what options I have on plate for this inter process communication

  • Can I have the executable file directly return a string array or an object (I don't think this is possible)?
  • Volatile variable that the exe file sets and the powershell script reads from?
  • Spawn a temporary .Net remoting server within the executable and have the powershell ping that server to get the results

Solution

  • You could just spit out the results from the EXE to stdout in XML or CSV format and have PowerShell slurp it up with either a cast to [xml] or ConvertFrom-Csv.