locked
run powershell from a website RRS feed

  • Question

  • Would it be possible to create a html page (IIS 6) that would be the web interface to run a powershell  commands. (including the output)
    I mean a create page put some buttons, and selectors, then these trigger a powershell script by the press of a button ?
    Sunday, October 2, 2011 10:28 PM

Answers

  • Yes, absolutely, if you have a budget and are looking to get up and running quickly look at "PowerShell ASP" from www.powershellinside.com

    Otherwise, use your favorite search engine and look for "powershell asp" to see what resources already exist.

    Likely your biggest issue is impersonation: You run your web server as an anonymous user, but you need the script to run something that needs higher priviledges.

    Sunday, October 2, 2011 11:28 PM
  • So here's the thing...  You need to decide if you're going to go with a commercial product or write something yourself.  If you've never done anything with ASP.NET, you might be a bit above your head.

    From what I remember (I don't have the book with me right now), this books has a few pages on how you would code such an ASP.NET app to interact with PowerShell to manage Exchange:

    http://www.wrox.com/WileyCDA/WroxTitle/Professional-Windows-PowerShell-for-Exchange-Server-2007-Service-Pack-1.productCd-0470226447.html

    Other than that, that's the best we can do to guide you in a volunteer-based forum.

    • Marked as answer by PGT2008 Tuesday, October 4, 2011 11:46 AM
    Tuesday, October 4, 2011 12:31 AM

All replies

  • Yes, absolutely, if you have a budget and are looking to get up and running quickly look at "PowerShell ASP" from www.powershellinside.com

    Otherwise, use your favorite search engine and look for "powershell asp" to see what resources already exist.

    Likely your biggest issue is impersonation: You run your web server as an anonymous user, but you need the script to run something that needs higher priviledges.

    Sunday, October 2, 2011 11:28 PM
  • oh i'm thinking of users running on validated website https (ntlm logon)
    So they would only allowed to run those powershell scripts if they have the rights to do so.
    For example an admin can run a script to create a new user
    but normal people would not be able to do it.
    The script has to be fired under the credentials of the logged on user (not by ISSadmin or service accounts).

    For something real cool it would be nice on sharepoint..some management tool in combination with that platform.
    But thats wishfull thinking for the moment :)

     

    Maybe i fail to see why the website you mentioned is what i need.
    Basically powershell does allready provide that (i can manage exchange remotely with powershell)
    And if i would like to do that trough an SSL tunnel thats no problem
    There are various SSL proxies (freeware) available.
    But this is not what i'm looking for.

    I want to create a page, that provides me a powershell script, run it under my credentials.
    All options i get from the page ( like for example the servername to run the script against)
    So i could create a page with daily tasks for creating mailboxes / users / printers / password reset/  etc etc





    • Edited by PGT2008 Monday, October 3, 2011 10:50 PM
    Monday, October 3, 2011 10:43 PM
  • So here's the thing...  You need to decide if you're going to go with a commercial product or write something yourself.  If you've never done anything with ASP.NET, you might be a bit above your head.

    From what I remember (I don't have the book with me right now), this books has a few pages on how you would code such an ASP.NET app to interact with PowerShell to manage Exchange:

    http://www.wrox.com/WileyCDA/WroxTitle/Professional-Windows-PowerShell-for-Exchange-Server-2007-Service-Pack-1.productCd-0470226447.html

    Other than that, that's the best we can do to guide you in a volunteer-based forum.

    • Marked as answer by PGT2008 Tuesday, October 4, 2011 11:46 AM
    Tuesday, October 4, 2011 12:31 AM
  • Ok hmm i think i've seen that book on my colleagues desktop, i'll  ask him about it.

    Yes I had decided to write my own; and was looking for help in that direction; but i was not really sure it would be possible.
    This might not be the best forum to ask about such questions, there are programmers forums/ script forums.

    I need some free time for this to develop; maybe i get back later here and post my solution (but that might take some while)


    • Edited by PGT2008 Tuesday, October 4, 2011 11:49 AM
    Tuesday, October 4, 2011 11:46 AM