Fortunately, embedding the PowerShell core and executing commands / scripts and getting the results back is pretty trivial. However, I'm not sure if the script is the one where I would include PowerShell. You ask if people prefer to run scripts from their own shells or from an instrumental vendor environment. I can't speak for everyone, but the shells and editors that I use support some great features for debugging, code folding, syntax highlighting, a few spaces, etc. Iām not sure that you will want to complete efforts to provide similar opportunities,
One reason for enabling PowerShell is to run the same PowerShell cmdlets as part of your kernel for diagnostics and monitoring. Thus, you do not need to duplicate functionality between your diagnostic tool tool engine and the cmdlets that your clients use to automate. Does the code that you use for diagnostics and monitoring in the application seem to be different from the code in the cmdlets? Or is there common code shared between the application and the cmdlets?
Another reason to enable PowerShell is to allow the script itself to be a script, but this does not match your script.
Another reason to enable PowerShell is because you are deploying a new host, that is, you provide some unique editing or shell features. Some applications that do this are PowerGUI (which lets you run IIRC scripts) and PowerShell Plus.
Another reason I included PowerShell in the application was because I knew that I could get certain results with much less code than the equivalent C # code. This is a weaker reason, and I probably would not have done it in a commercial application, but I used it for one-time programs.
Keith hill
source share