0

Recently created a MVC2 Portal but now I want to add a couple of models that call out to other processes such as powershell in order to run some tasks for the user and return the results.

All the examples I've found show the MVC model binding to SQL so the question is can MVC be used for what I'm asking of it and if so does anyone know of some examples that I can look at etc.

Any suggestions or comments are appreciated.

ServerMonkey
  • 1,042
  • 3
  • 19
  • 42

2 Answers2

0

All things are possible, but I suspect the issue you're going to have is that of security and the user account that you're running your website under.

Generally, the AppPool that an IIS website runs under is set up to run as Network Service or as some other account that has limited access to the file system. That service generally doesn't have it's profile (Desktop) loaded either.

You can certainly run the AppPool as a local account, and can load that user's profile (these settings are found in IIS manager) but by doing that you need to understand the security implications.

Having given you this "health warning" one example of hosting powershell in ASP.NET can be found here...

http://www.leastprivilege.com/HostingPowerShellInASPNET.aspx

... and another slightly longer one here...

Link

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Martin Peck
  • 11,440
  • 2
  • 42
  • 69
  • Is there impersonation for mvc? – dexter Nov 23 '10 at 22:19
  • @max Yes. As far as I know. This http://stackoverflow.com/questions/1405612/impersonation-in-asp-net-mvc touches on impersonation. – Martin Peck Nov 23 '10 at 22:22
  • I had planned to use impersonation to ensure the PowerShell hosted applications ran under a privileged ID, these are admin scripts so privilege separation is definitely required. – ServerMonkey Nov 23 '10 at 22:29
0

Closed due to lack of response, will look at doing a custom model which talks to powershell runspace.

ServerMonkey
  • 1,042
  • 3
  • 19
  • 42