Share via


Calling powershell Script in an HTML Button OnClick function

Question

Saturday, July 25, 2015 9:39 PM

is it possible to call or execute a Power shell script when i click on a Button in an HTML page?

I have Power shell scripts. I would like these scripts to execute when i click on a Button on a web page. Or executing script can only be done in Console?

All replies (1)

Sunday, July 26, 2015 9:44 PM âś…Answered

Hi,

You should be able to call al PS script via HTML onclick targetting C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ``-Command C:\Scripts\MyScript.ps1

But I'd suggest to use XAML to build a graphical interface to call your scripts, I started to build a powershell GUI (XAML & Powershell) that is a main menu to call my PS scripts located on a shared folder, I followed this great article : http://foxdeploy.com/2015/04/16/part-ii-deploying-powershell-guis-in-minutes-using-visual-studio/

I think it's more flexible & easier than HTML, and you can do much more things (menu / tabs etc...) using visual studio express to design the graphical interface. Just my point of view :)