Skip to the main content.

How scripts work in ScriptRunner

You can use scripts in many ways

Implementing the application

Main scripts

Each action in ScriptRunner uses a main script that maps the specific application case with PowerShell. You can predefine the parameter values for the script or define them as proposals.

The execution of this script in the target system is controlled by the action’s policy set.

Queries for parameters

Query scripts

You can create the interactive selection for parameter values dynamically using a query script. The user can select from a display list and the corresponding parameter value is used in the main script.

You can use it with different scripts at the same time. You can also cascade queries.

Validation of inputs

Validation scripts

It is always necessary to check the input of users in the web apps forms.
While simple validations are already integrated into the web apps, scripts allow you to map even the most complex validations for each parameter.

This allows you to prevent user input errors in a targeted manner.

Function library

Function scripts

Frequently used functions in PowerShell scripts can be stored in a function library. The functions can be loaded via the policy set for the action.
In the main script you can use the functions simply by calling them.

There is no need to copy identical code sections into main scripts.

Structure of scripts and headers

PowerShell supports script header information as the programming language. While the headers for interactive application in the PowerShell console or PowerShell ISE are irrelevant, the opposite is true for PowerShell scripts. Microsoft recommends using both script headers and parameter declarations in its “best practices for PowerShell Scripting”.

Scripts written according to these best practices can be used immediately in ScriptRunner. Please note that the scripts are processed by controlled processes in the background and the interactive entries are made before them.

The PowerShell scripts in our ScriptRunner ActionPacks follow these guidelines and can also be used as templates.

PowerShell-Script-Header-t

ScriptRunner Software Download

  • 30 days free of charge and without obligation.
  • We are happy to support you.

Get your free trial

Automatically generated input forms in the browser

You want to use PowerShell scripts to map a wide variety of business logic for automation and delegation. However, the scripts should not be used on the command line, but via an understandable, uniform graphical interface.

ScriptRunner automatically provides graphical input forms for all users in the browser without the need to program. You only need to provide the scripts themselves with a descriptive header and a param block. Everything else you get for free.

The thanks of your users are sure to be your reward!

scriptrunner-input-forms-technology-600x257-t-1

Executing scripts

When an action is triggered in ScriptRunner, a separate PowerShell process is started first in the context of the configured execution rights in the ScriptRunner system. The script, all parameters and other information are passed to this process.

Scripts can be run in Local Mode, PowerShell Remoting and PowerShell Implicit Remoting. In Local Mode the complete script processing is done in the ScriptRunner system. PowerShell Remoting establishes a connection to the target system and also starts a PowerShell process there. The script and all data are passed to this remote process. Both processes, local and remote, communicate with each other. The script is processed exclusively remotely, the results are transferred to the ScriptRunner system. Implicit remoting imports the remote PowerShell session into the ScriptRunner system. The processing is a mix of Local Mode and PowerShell Remoting and is especially needed for Exchange and Skype for Business.

PowerShell-Modi-600x338-t

Confirmations and report information

As an administrator, you want to be able to see at any time how the scripts were processed and which results or errors occurred. ScriptRunner supports you with comprehensive reports.

A section with meta-information reflects the processing and rights context. The following information block shows the parameter values with which the script was started. A summary of the results is displayed in the result message section. This summary is freely definable and can be assigned using a PowerShell system variable. The result message is also used in the Delegate Web App to give users interactive feedback about the result of the executed actions.

The classic PowerShell report appears in the last section. You can add output to each of the processing steps in the script that are to additionally appear in the report.

Report_mit_Resultblock