Open donker opened 7 years ago
As far as I know, there is parity between PS Modules whether done in scripts or in code.
I agree with @jbrinkman and believe you can do almost everything between the two. The scripts IMO can get a little bit ugly when you are doing something complicated. Perhaps the best approach to this is building a Core module that will be written in C# let's say and then a scripting module that is a wrapper that communicates with the Core Module.
This architecture makes sense to me to allow other developers to extend this. For example the app that nvisionative have might want to directly integrate with the Core module. I could also see potential for other systems and tools to leverage a core module.
The big question will be where does the Powershell scripting code end and where the C# code begins. IMO I think creating a simple API from a dll that the powershell code just wraps up will create great flexibility which is the intended vision of this project.
What do you guys think about having this hybrid approach?
I'm in favor of hybrid for sure. I have begun a C# project. What I think is the best way forward is to see how the end point in that code (i.e. the commands) are defined. Is it generic enough? Etc.
Case in point: there is a method to add a site to your (local) site list. This takes key/id, url, username and password as params and then goes out to get a JWT token from the site. I think a script would handle the more UI focused aspects like showing the user a safe password entry box and handling any errors and providing feedback.
From my earlier PS work I veered between doing stuff in .net in a dll and using ps scripts for other commands. Any preference here? Here are IMHO pros and cons (from which you can deduce my preference):
Pros of C# dll over PS:
Cons: