3

Is there a way to call a specific function from a PowerShell script from C# code?

I have the basic example up and running that executes a string with a PowerShell script.

What if i have a file with many functions and i'd like to load only a particular one into C# and execute it ?

How can this be done?

Also, is there a way to load the parameters into this function dynamically, without actually knowing ahead which is the function that is loaded?

Thanks!

lysergic-acid
  • 19,570
  • 21
  • 109
  • 218
  • There was a similar question some time ago, take a look at the answer (though it was not accepted): https://stackoverflow.com/questions/4179351/calling-powershell-functions-from-c/4182444#4182444 – Roman Kuzmin Apr 03 '11 at 12:06

0 Answers0