ScriptRunner Portal Edition R1
15 min read
By: Frank Kresse Jun 22, 2021 10:50:00 AM
Table of Contents
Portal Edition R1 is the first release in a series of versions that focus on expanding the role-based ScriptRunner Portal and completely replacing the previous Web Apps.
Release 1 introduces many new features around the management and development of scripts and makes them available for the first time in the Portal app “Scripts” in the browser:
- Integrated Script Editor
- View, modify and save scripts directly in the Script Library
- Controlled access with check-out and check-in of scripts
- Versioning of scripts and comparison of versions
- Restore versions
- Import of own scripts and scripts from ScriptRunner ActionPacks
- Development of new scripts with templates
Further features in Release 1 are:
- Separation of Licensing and Settings Portal App
- Online ordering additional licenses in the Licensing App
- Canceling an action still in progress in the Run App
- Additional WYSIWYG settings on Actions
Release 2 of the Portal Edition will go public in September and will cover configuration elements and multi-backend capabilities.
The old End User Self-Service App and Help Desk App will be dropped from this release without replacement.
The final stage of development will be Release R3 with full configuration capabilities in the Portal.
Settings for the Script App on the Server
Different modes can be set for the operation and functions of the Script App. The choice of modes depends on the work and workflow model for script development. In principle, two working models can be distinguished:
- Developing scripts by a few administrators directly on ScriptRunner. This is a one-step procedure. Each administrator is solely responsible for their developed scripts. They can import scripts directly into ScriptRunner, create new scripts and change them. Versioning and control of editing is done in ScriptRunner.
- Develop scripts using code management systems in a multi-step development process, such as GitHub, GitLab, Bitbucket, etc. Administrators develop scripts in various repositories under control of code management. The release processes for the scripts, versioning and control of editing the scripts is done there and not on ScriptRunner Server.
The settings can be viewed in the Settings App under Script Library.
The appropriate mode is set on ScriptRunner Server with the command
Set-AsrSettings -ScriptEditMode On/Off/ViewOnly/Restricted -restart
Get-help Set-AsrSettings -Full
The New Script Edit Modes
This setting allows all administrators to import, recreate, check out, check in, modify, revoke or reset scripts to an old state in the ScriptRunner Portal. This meets the requirements for the working model with a one-step development process.
The script editor functions are completely disabled. The code of the scripts is not displayed. This setting is useful in the work model of a multi-step development process, as well as in production environments with higher security requirements regarding the viewing of the script code.
The functions of the script editor are disabled, but the code of the scripts can be viewed. This setting is recommended for the working model of a multi-level development process with a code management system and sync of the repos to the ScriptRunner server.
The functions of the script editor are restricted to the system directory _Upload_ on ScriptRunner Server. This setting is recommended for fast script prototyping. Administrators can use all functions of the Portal App for scripts restricted to this system folder. The other folders of the script library remain excluded and thus protected from changes.
The restricted mode is a very good combination of the advantages from both working models. Fast prototyping and testing in a one-step development process. Subsequent transfer of the prototype into the multi-stage work process using the code management system. The sync folders of the repos on ScriptRunner remain protected from changes past the code management.
Additional settings take effect when using the ON/restricted modes:
# Require a comment for every ScriptRunner script check-in
Set-AsrSettings -RequireScriptCheckinComment yes/no -restart
# Every script checked in from ScriptRunner is written
Set-AsrSettings -ArchiveScriptCheckIn yes/no -restart
Using Cmdlets from PowerShell Modules directly in Actions
In addition to PowerShell scripts, cmdlets from standard modules or custom-written PowerShell modules can be used directly in actions. The behavior of the input forms is determined by the exported cmdlet. In the script library, each cmdlet is displayed in the list of scripts and tagged with the module name.
A great advantage in direct use is when the respective cmdlet exactly maps the input and function requirements of the action. Also, in ScriptRunner, the cmdlet can be combined with queries.
List of cmdlets from the ScriptRunnerSettings PowerShell module
To add the cmdlets from modules to use directly:
# Add module cmdlets to ScriptRunner Script Library
Set-AsrPsModule -Module modulname -restart
# Remove module cmdlets to ScriptRunner Script Library
Remove-AsrPsModule -Module modulname OR -All -restart
The New Portal App “Scripts”
All new and old script library functions are bundled in the new Portal App for Scripts. It is accessed via the corresponding app tile in the Portal and first opens the familiar list of scripts in the library.
This app is only available for ScriptRunner users in the “Main Administrator” and “Administrator” role.
The search box in the top bar can be used to search for scripts and functions in full text. Clicking on one or more tags filters the view accordingly. The buttons for creating or adding scripts, also in the upper control bar, are only available in the script edit mode ON and Restricted.
The context menu at each entry in the list allows you to share the script for editing, view all PowerShell reports that generated executions of that script, and change ownership; only in the Main Admin role and using Team Repositories. See also the blog post on Version 2020R3.
Detail View and Integrated Script Editor
Clicking on a script switches to the detailed display. Under “General” the metadata for the script as well as data from the script header are displayed. The tab “Code” contains the integrated script editor. This can also be used in dark mode. The integrated editor displays the script code clearly and color-coded.
In script edit mode OFF this tab is switched off and is not displayed, in ViewOnly-mode the editing functions are switched off, the script code can be viewed.
Integrated script editor in dark mode
Under the tab “Change history” you will find a list of all changes. Changes to the respective previous version can be displayed, and an older version can be restored. The restore is only available in script edit mode ON for all scipts or Restricted only for scripts in the system folder _Upload_.
Change history of a script
In script comparison display mode, the previous version is displayed on the left and the selected version of the script is displayed on the right, as is common in code management.
In the script comparison display mode, two versions of a script can be displayed in parallel
In the “Used by” tab, an overview of the actions and script queries in which the selected script is used is displayed
Check-Out, Check-In and Revoke
In the script edit mode ON the functions for editing are available for all scripts, in Restricted only for scripts in the system folder _Upload_.
The script in question is checked out for editing on the code tab. Script editing is blocked for all other administrators. The script library list shows who has checked out the script. An editing copy is created on the ScriptRunner server. Configured actions will continue to use the last valid script from the library.
The edited script will be checked in after completion. An input prompt for additional history information is displayed (the settings can force an input). The editing lock is released and a new version of the script is used for newly started actions from this point on. The previous version of the script is stored in the history on the ScriptRunner server.
The editing of the script is discarded. The status of the script is reset. All changes in the script are lost.
The new import wizard is available for importing scripts. It is only available in the script edit mode ON or Restricted. In ON mode, scripts can be imported into all folders authorized for the administrator, in Restricted only into the system folder _UPLOAD_.
If roles of the type “Administrator” are used and team repositories have been set up on ScriptRunner, users with this role in script edit mode ON can only save to team repositories to which they have access rights. Users in the “Main Administrator” role can save to all folders in script edit mode ON.
The wizard starts when clicking the “Import script” button. In multi-team mode, the ownership for the script is set first. The selection depends on the role of the user. The ownership “Public” makes the script available for all administrators, otherwise only for restricted for members of the selected admin team.
Selection of scripts to import
Scripts can be selected for import via drag-and-drop. Selecting the script library folder assigns the location and automatically the default tags for this folder.
In script edit mode Restricted the folder selection is omitted, because all scripts are imported to _UPLOAD_. With the three directly selectable system tags, the usage type for the script can be specified.
Additionally, scripts can also be imported directly from ScriptRunner ActionPacks on GitHub. This feature is only available if there is an internet connection.
Button for uploading scripts from ScriptRunner ActionPacks
After clicking the button “ScriptRunner ActionPacks”, a dialog window pops up in which the desired script files can be selected and added directly to the selection list.
Selection of the desired script for import
In the final step of the wizard, all scripts are displayed in the script editor and changes can be made if needed.
In the last step of the import wizard, you can make changes to the scripts
After the import wizard is finished, the imported scripts are available for use in ScriptRunner as usual.
Creating Scripts from Templates
ScriptRunner now supports administrators developing scripts with provided templates. The template collection is continuously improved and extended.
The new Create Wizard is now available for creating scripts. This is only accessible in script edit mode ON or Restricted. In ON mode, newly created scripts can be saved in all folders authorized for the administrator, in Restricted only in the system folder _UPLOAD_.
If Administrator type roles are used and Team Repositories have been set up on ScriptRunner, users in this role can save in script edit mode ON only in Team Repositories to which they have access rights. Users in the Main Administrator role can save to all folders in script edit mode ON.
Create Wizard starts when you click the “Create new script” button. In multi-team mode, the ownership for the script is set first. The selection depends on the role of the user. The ownership “Public” makes the script available for all administrators, otherwise only restricted for members of the selected admin team.
Definition of the script details
A new script can now be created. To do this, the file name for the new script must be specified. A file name may only exist once within the same folder.
The selection of the Script Library Folder assigns the storage location and automatically also the standard tags for this folder. In script edit mode Restricted the folder selection is omitted, because all scripts are stored in _UPLOAD_. With the three directly selectable system tags the usage type for the script can be further specified.
Selecting a script template
Templates can be selected from a dropdown menu. There, both no template (empty) or one of the displayed templates can be selected. This feature is only available if there is an internet connection.
In the last step of the wizard the new script based on the template is displayed in the script editor and can be edited directly.
In the last step of the create wizard, the script can be edited
After the wizard is finished, the script is available for use in ScriptRunner as usual.
New: Notification Center
The new Notification Center is a container for short-term system and error messages from processes that interact with the server in the background and are not related to direct, interactive input on the portal.
The information is browser session-bound and volatile. Access is via the icon in the top bar. After the notifications are displayed, the badge signaling new notifications is reset.
The Notification Center can be opened by clicking on the tray icon in the top bar
New in the setup
In the update, the path to the complete transition to “Portal only” is demonstrated by the fact that the End User Self-Service Web App and the Delegate Web App can only be installed optionally and are “not selected” by default in the setup.
New in Portal App “Run”
A particularly interesting feature for users in the two administrator roles is the individual cancellation of running actions. This can be necessary if an action was started by mistake or if a PowerShell script does not finish running. Canceling an action is possible in the Action Runner as well as in the Report window.
Cancel Button in Action Runner
Cancel Button in Report Dialog
In the configuration for help desk and end users the display tabs of actions in the portal can now be configured and displayed.
The configuration is done via the context menu for the action on the tile or on the list item.
The administrator now has the possibility to see colors, icons, tabs and texts for the action as users in the help desk or end users would see them as well. If an action is configured with one or more display tabs, it will only appear on those tabs. Otherwise the action tags are used as tabs.
List of Actions
When an action is selected, the queries in the form can now be triggered using the Enter key in addition to clicking the search magnifying glass.
New in Portal App “Reports”
A new feature in the report filters is the “Clear all filters” function, which allows you to switch more quickly to the “Show all reports” state. In addition, the tooltips in the report display window have been expanded.
The new tab “Error messages” now shows separately occurred errors with hints, which arose during the execution of the action or script query. This tab is only available for users in the administrator roles.
Error message tab in the detail view of an action
New in Portal App “Authorize & Delegate”
When using the multi-team administrator model, all elements in ScriptRunner can be assigned under ownership to the respective administrator teams. In addition, a separate script repository can be set up for each administrator team.
To do this, a folder for each team repository must first be physically created in the root folder of the ScriptRunner library on the server. Then, a user in the Administrator role can assign the corresponding team repository folder to the team.
Assigning Team Repositories
With the lifecycle model for PowerShell 7, Microsoft has introduced a process with which PowerShell 7 is delivered as a runtime in products from other manufacturers.
To provide a stable basis for this, Microsoft marks certain releases with LTS (Long Term Support). The delivery version of ScriptRunner PowerShell 7 Host on ScriptRunner Server has been updated to the latest LTS 7.0.6.
The next major update of PowerShell 7 with LTS is announced for the end of 2021 with version 7.2. For more information, see the PowerShell Core support lifecycle article in the Microsoft documentation.
New in Queries
In the Admin App, when editing a cached query in the Cache Viewer, the entire cache can now be searched for expected elements. This is a significant improvement, especially for larger caches, as the previous limitation to the first 500 elements has been removed.
Cache Viewer in the ScriptRunner Admin App
Sample Scripts for Application with the Web Service Connector
The sample scripts for using Web Service Connector have been removed from the delivery version. A new script has been developed which consolidates all variants for using the Web API to launch actions by third party systems.
The script is now in the ActionPack repository on GitHub: ScriptRunner Software on GitHub
Try Portal Edition R1 now!
Discover the new features and benefits of automation and delegation with PowerShell!
About the author:
Frank Kresse is the Head of Product and CEO of ScriptRunner. As the inventor of the automation and delegation solution for PowerShell, he advises clients on use case scenarios and develops solutions for the automation and the digitalization of their processes. He is also involved in technology start-ups.