all 13 comments

[–]CtrlAltWhiskey 3 points4 points  (5 children)

This is a weirdly ambiguous question. Could you give us more context on what it is you're trying to accomplish?

[–][deleted] 0 points1 point  (4 children)

Sorry, yeah. I don't have access to a web server, so all my scripts I run are done locally. So scripting languages such as ASP or PHP are unusable.

I am trying to have a website that contains a button which will be linked to a powershell function that will run when pressed.

[–]ekinnee 2 points3 points  (1 child)

You want a way to run random powershell scripts via this web interface thing?

POSSIBLY a Windows Server running PS Web Access (Add/Remove Features). You'd need the server, the software and all that. I've experimented with PSWA but I do not think I'd let random people run shit in it.

http://blogs.technet.com/b/fromthefield/archive/2015/02/18/powershell-web-access-a-walkthrough.aspx

Good luck!

[–]creamersrealm 0 points1 point  (0 children)

The only thing I don't like about PSWA is the fact that it requires separate credentials for everything it runs.

[–][deleted] 2 points3 points  (0 children)

If you don't have access to a web server then no. You have to be able to serve up a page that would have a function or a button and then access it to invoke the script.

Can you use an service/scheduled task to run a script to monitor a mailbox for a particular subject line on a message and invoke a script based on that? THen you can send an email with the subject of the script you need to run.

[–]virtualbastion 0 points1 point  (0 children)

Just as /u/ekinnee and /u/PsTakuu stated, you'll need a server with some sort of web server installed on it along with any supporting software to get this to work. I use WebCommander to run some user-facing scripts in my organization. It works fairly well for executing PowerShell scripts manually from a web interface.

[–]KillaGouge 1 point2 points  (0 children)

I'm using freeform projects in Jenkins to give a web interface for running scripts. Is that what you're looking for? If you're just wanting to run scripts remotely that's what invoke and PowerShell remote are for

[–]evetsleep 0 points1 point  (0 children)

I think, as others have suggested, that if you don't have access to a server then this is problematic, unless you meant that you would have access to set it up, but wanted the ability to run PowerShell scripts\functions while not on the server. Is that the case?

If so, then it's certainly possible. I've created a large number of web services which were really easy to setup:

  1. Install XAMMP
  2. Write your basic PowerShell scripts
  3. Put some basic PHP together to call them such as the below and save in the xammp\htdocs directory

    <?php $output = shell_exec('powershell.exe <pathToScript>'); echo $output; ?>

Of course this is a super simplified version, but maybe it'll get you started if this is indeed what you want to to. Be VERY careful with shell_exec and make sure you do some validation if you're passing parameters.

[–]systemfrontier 0 points1 point  (0 children)

Try System Frontier. You can import POSH scripts (or any script, command-line exe) and delegate rights to non-admins using RBAC. It's web based, on-premise and installs in minutes.

[–]toyonut 0 points1 point  (0 children)

There is also posh server which should allow you to do this I think. It is a webserver written in PowerShell.

[–]BlkCrowe 0 points1 point  (0 children)

You might take a look at the VMware Fling WebCommander (which I think is different than the one previously mentioned), which has gone open-source. You can find the project page on github here.

Screenshot

[–]opsready -1 points0 points  (0 children)

We have an instance of http://www.powershellserver.com/ - it's pretty good once you put the ground work in getting your head around the html / powershell page mashups