I am writing a C# application that needs to make use of a Powershell script file that is full of functions. What I need to do from my WPF app is:
- Launch the Powershell ISE (working fine)
- I need to have functions that are in a .ps1 file on the filesystem available to the user when they open the ISE. (not working)
Some pseudo code might look like this:
Process.Start("powershell_ise.exe");
PowershellSession session = GetPsSession("this user");
session.Load("functions.ps1");
I've been looking around the System.Management.Automation classes, but can't find anything useful. Thank you.