WebCommander provides the simplest way ever to run and share Powershell scripts.
It provides a user friendly and intuitive web GUI for human users to trigger a script and view its result. At the same time, it wraps the script as a web service, whose interface and result are both in the format of JSON, to be easily consumed from other applications.
It provides a workflow engine to run multiple scripts together to handle more complex tasks. The web GUI also helps users to design, run, save and reuse workflows with simple mouse clicks.
It allows execution of scripts and workflows located anywhere on internet without any effort to clone and maintain local copies.
On WebCommander, users trigger a script from the web interface. Each script parameter displays as a web form field whose name, help message, necessity and value sets are all clear to the user at a glance.
The web GUI also displays script result far more human friendly. Especially when it returns a large number of items, the paged tabular output could be easily sorted and filtered.
Behind the user friendly GUI, WebCommander actually generates outputs in JSON format, which makes it easy to be consumed programmatically from other applications.
All execution results are saved on server as JSON files or stored in MongoDB. They could be retrieved by running the built-in “History” command.
WebCommander allows to run multiple scripts together. This is called workflow.
A workflow could run scripts one by one (serial) or all at the same time (parallel).
- Serial workflow
- Parallel workflow
On the web GUI, users could add / delete / enable / disable / move scripts simply with mouse clicks A workflow could be imported and exported as a JSON string, which could also be saved on WebCommander server for future reuse.
A workflow could be turned into a single command and then embedded into other workflows. Consequently it’s able to map any execution sequence, no matter how complicate it is.
WebCommander could not only run scripts located on its local disk but also those stored on internet. For instance in the script definition JSON below, script location is http://bit.ly/1Rc823E.
The script definition JSON file itself could be on internet as well. To share Powershell scripts with other WebCommander users, we would simply
- put all scripts and the definition JSON file on a public web server, such as AWS, OneDrive, Github and Dropbox
- publish the URL of the definition JSON file
To use those shared scripts, we just add the URL to sources.json
- How to execute an individual command http://youtu.be/CREkoloCOmk
- Workflow basics http://youtu.be/ZJtU36kM2YY
- Workflow variable http://youtu.be/i6z_HKgeiqY
- Workflow template http://youtu.be/adXa6AHJaB8
- Run workflow as command http://youtu.be/DAm70VO62VY
- Save workflow on server http://youtu.be/_aEZhzk_Q2Y
To deploy webcommander on Windows 2008 or 2012, please follow the instructions at https://pascalswereld.nl/2017/06/02/webcommander-walnut-installation-walk-through (by Pascal)
Restful APIs are implemented via Silex. To install Silex, run the command below under folder www/rest/
composer require silex/silex:~2.0
Composer for Windows could be found at https://getcomposer.org/doc/00-intro.md#installation-windows
Enable URL rewrite on IIS https://www.iis.net/downloads/microsoft/url-rewrite
Installing the MongoDB PHP Driver on Windows http://www.php.net/manual/en/mongodb.installation.windows.php
For non server Windows (vista and newer), checkout source code from walnut branch and open www folder from WebMatrix (https://www.microsoft.com/web/webmatrix/)
If you want to contribute code or get any idea to improve WebCommander, Please contact Jian Liu Skype: [email protected].
API | Method | Body | Description |
---|---|---|---|
api/v1/showCommand | Get | List all command definitions | |
api/v1/showCommand?script=<script path> | Get | List the definition of the specified command | |
api/v1/showHistory | Get | List all execution history records | |
api/v1/showHistory/historyID | Get | List the history record specified by ID | |
api/v1/runCommand | Post | JSON string as listed below | Execute a command specified by the posted JSON string |
{
"script": "vSphere\\interfaces.ps1",
"method": "listPortgroup",
"parameters": [
{
"name": "serverAddress",
"value": "1.1.1.1"
},
{
"name": "serverUser",
"value": "root"
},
{
"name": "serverPassword",
"value": "password"
}
]
}
Index.html could generate this JSON string. After running a command through index.html, the result JSON will show in the JSON tab. That JSON string could be used to trigger runCommand API as well.
docker run --name webcommander -d -it -v "c:\program files\windowspowershell\modules":"c:\program files\windowspowershell\modules" 9whirls/webcommander:walnut