I have an engine that executes powershell scripts, and when they execute, need
to feed back in some xml to the caller. The engine only takes i/o as an idmef xml message. So the script needs to return a similarly formatted xml message. I have a class which does my formatting for me and it would like the script writers to use it.
So question is I want to wrap a c# class to enable it to be used by powershell.
I saw something some where you can refer to c# class using the square bracket mob, eg.
How to you make the c# available to be used like this. I reckon it needs to be made into class lib and somehow loaded into the powershell runtime but how. Also as I’m running the powershell from c#, how do I add it into the environment at that point.
Any help would be appreciated.
Bob.
If have an assembly (exe or dll) with the class in it, PowerShell can load it via
[System.Reflection.Assembly]::LoadFile("PathToYourAssembly")or in V2
If you are creating a runspace in your application and would like to make an assembly available, you can do that with a RunspaceConfiguration.