Skip to the main content.

ScriptRunner Blog

ScriptRunner version 2019R3

  • Windows Server 2019 Desktop Experience and Core
  • Support for Windows Server Active-Passive-Cluster
  • Customizable HTML reports for PowerShell
  • Support of new input validations (RexEx)
  • Enhancements _QUERY_ and _LIB_
  • Extended Web Service Connector
  • Improvements to the CyberArk Connector
  • Additional functions for license management
  • Customizable Admin App
  • New ActionPacks
Post Featured Image

With version 2019R3, we provide you with an additional update containing new features and some fixes before the next major update to ScriptRunner version 2020.

 

Short overview

Download ScriptRunner version 2019R3 from our Support site

The most important new features in version 2019R3 are

  • Windows Server 2019 Desktop Experience and Core
  • Support for Windows Server Active-Passive-Cluster
  • Customizable HTML reports for PowerShell
  • Support of new input validations (RexEx)
  • Enhancements _QUERY_ and _LIB_
  • Extended Web Service Connector
  • Improvements to the CyberArk Connector
  • Additional functions for license management
  • Customizable Admin App
  • New ActionPacks

 

Support for Windows Server 2019
ScriptRunner version 2019 supports implementation on Windows Server 2019 as a recommended operating system. The following configurations are supported:
  • Windows Server 2019 with Desktop Experience
  • Windows Server 2019 Core with ServerCore.AppCompatibility Feature Set installed

You can download and install the Feature Set as a Feature-on-Demand package from the Microsoft website.

 

Discontinued operations

  • Windows Server 2012 will no longer be supported in the future. New installations and migrations should be done on Windows Server 2019.
  • ScriptRunner in versions 2016 and 2017 will no longer be supported after 06/01/2020. We recommend an update to the current version 2019R3.

Support for Active-Passive Cluster

ScriptRunner 2019 can be installed in a Windows Active-Passive Cluster to increase reliability.
During operation, the following resources are used in sharing:

  • Script repository
  • ScriptRunner Configuration
  • Reporting database

The following settings are bound to a cluster node:

  • Program binaries
  • Work directories
  • Log directories
  • Windows event log entries
  • Windows Performance Counter
  • Active PowerShell processes during script execution
  • Credentials for script execution
  • License file and activation keys
  • ScriptRunner connectors
  • Installed/applied PowerShell modules

ScriptRunner must be installed on both cluster nodes. In the Cluster Manager, the cluster resources for the node resources and the shared disk must also be set up.

The URI for ScriptRunner Web Service and the Web Apps is provided externally by a resource with a client access point.
Detailed instructions for cluster installation can be obtained from ScriptRunner Support.

 

Customizable HTML reports

ScriptRunner provides detailed reporting on the execution of actions and thus the execution of PowerShell scripts. The previous reporting included the following information:

  • Meta information about the script execution
  • Input parameters
  • Result- or Error-Messages
  • PowerShell console output

With this information, the execution of the PowerShell scripts can be monitored and auditing can be ensured.

With the growing distribution of PowerShell, however, the demands on the content and presentation of result reports are also increasing. Especially evaluations and overviews should be highlighted here.

PowerShell itself offers the possibility to output results as HTML documents with the ConvertTo-Html function. Additionally, there are two popular modules, ReportHTML and PSHTML in the PowerShell gallery to create extensive graphical reports with PowerShell.

With version 2019R3, ScriptRunner now offers this functionality for delegation and automation.

In our video Heiko Brenn, product expert at ScriptRunner, gives you an overview of the new feature:

 

 

New use cases with HTML reports

The new function opens up new use cases for ScriptRunner:

Administrators benefit from more meaningful and clearer reports on script execution results. In particular, recurring analysis and reporting script runs on resource usage, permissions, configurations, etc. are examples.

Service desk users benefit from a clear and attractive presentation of results of executed actions.

Specialist users are now also moving more into focus. Specific analyses and evaluations for this group can be written with PowerShell (e.g. for the evaluation of distributed data in O365, teams, SharePoint, databases, etc.) and can be prepared in a comprehensive visual format. The processing of the data takes place in the background and the specialist user receives a link to the finished report.

 

PowerShell built-in ConvertTo-Html

The PowerShell itself provides a function for generating HTML reports. The presentation of the HTML can be controlled with an appropriate CSS stylesheet, for example to apply headers and footers, fonts and colors to all reports.

The corresponding output is generated in the PowerShell script. The following code snippet shows how to create the output and assign it to ScriptRunner via the system variable $SRXEnv.ResultHTML :

$preContent = "

$(Get-Date -Format 'dddd yyyy-MM-dd HH:MM:ss')

"
$postContent = "

by $($SRXEnv.SRXStartedBy)

"
$SRXEnv.ResultHTML = Get-Process -Name $name |
Where-Object -FilterScript { $_.TotalProcessorTime } |
Sort-Object -Property VirtualMemorySize64, TotalProcessorTime -Descending |
Select-Object -Property Name,
Id,
@{
Label = 'VirtualMemory';
Expression = { '' + [math]::truncate($_.VirtualMemorySize64 / 1MB) + 'MB' }
},
TotalProcessorTime,
@{
Label = 'TotalRunningTime';
Expression = {(get-date) - $_.StartTime}
},
Productversion,
@{
Label = 'Path';
Expression = {
if ($_.MainModule -AND (Get-Member -InputObject ($_.MainModule) -Name 'FileName' -MemberType Properties)) {
$_.MainModule.FileName
}
else {
"---"
}
}
} |
ConvertTo-Html -Title 'Get Process' -As 'Table' -CssUri './sr-table.css' -PreContent $preContent -PostContent $postContent

The HTML file is saved in the following directory

C:\ProgramData\ScriptRunner\Service\Local\ResultFiles

The display for all users, as shown in Figure 1, is provided by the virtual path http(s)://fqdn/scriptrunner/reports/abcdexyz.html
 
 
Figure 1: Display of ConvertTo HTML reports in ScriptRunner

Figure 1: Display of ConvertTo HTML reports in ScriptRunner

More information about ConvertTo-Html can be found in the Microsoft documentation.

 

Support of popular HTML converter modules

The flexibility of ScriptRunner allows the use of special HTML generator modules in addition to the standard ConvertTo-Html function. Among others, the following modules are recommended for this purpose:

Both modules provide an extended instruction set for generating HTML reports. This includes page structure and page display with tabs, different graphics, search field, etc.

Figure 2: Report generated with the ReportHTML module displayed in ScriptRunner

Figure 2: Report generated with the ReportHTML module, displayed in ScriptRunner

An example script for using ReportHTML with ScriptRunner can be found in our ActionPack on Github.

Within our ActionPacks we will successively provide more reporting scripts or refer to such scripts in other GitHub repositories.

 

HTML reports in ScriptRunner

The use of HTML reports is supported starting with ScriptRunner version 2019R3. The following extensions are implemented for this purpose:

  • System Hashtable: SRXEnv.ResultHTML
  • Virtual directory on the IIS …/scriptrunner/reports. Each report gets its own GUID there
  • Standard CSS on

 

C:\ProgramData\ScriptRunner\Service\Local\ResultFilessr-table.css<
[/code]</li>
<li>Admin Web App: extended metadata in PowerShell reports with link to the report</li>
<li>Delegate and Self-Service Web App: enhanced dialog box with link to the HTML report that is displayed during action execution</li>
<li>Delegate Web App: extended overview with link to the HTML reports</li>
</ul>
<p><strong>The HTML reports can be accessed in 5 ways:</strong></p>
<ul>
<li>Link in the Admin Web App</li>
<li>Link in the Delegate Web App</li>
<li>Link in the dialog box of the Self-Service Web App</li>
<li>Sending the report from a ScriptRunner action</li>
<li>Sending the report from the script via <em>$SRXEnv.ReportEmail</em></li>
</ul>
<h2>Additional input validations</h2>
<p>To increase usability and application breadth, ScriptRunner's support for data types and input validations has been enhanced.</p>
<h3>Regular expressions</h3>
<p>The automatically generated input fields in the Web Apps now also support the input of controlled regular expressions. The validation information is generated from the PowerShell script and must be defined in the param block of the script.</p>
<pre class="lang:powershell">param
(
[ValidatePattern("^[^@]+@.+$")
[string]$RegEx
)</pre>
<h3>Multiline text input</h3>
<p>In some applications, longer text entries are required as input parameters. The new multi-line feature can be used for this purpose. The definition is done in the param block of the script.</p>
<pre class="lang:powershell">param
(
[Parameter(HelpMessage="ASRDisplay(Multiline)")
[string]$MultilineText
)</pre>
<h3>Hidden text</h3>
<p>In some applications, text entries should not be invisible on the screen, but should be displayed as a chain of dots. The new Hidden Text feature can be used for this. The definition is done in the param block of the script.</p>
<pre class="lang:powershell">param
(
[Parameter(HelpMessage="ASRDisplay(Password)")
[string]$HiddenText
)</pre>
<h3>Secure string type</h3>
<p>In some use cases it is useful to use the <em>SecureString</em> data type. In the externally visible application, it does not differ from the extended attribute <em>Hidden Text</em>. However, when used within the script, use appropriate cmdlets that support this data type or perform conversions.</p>
<pre class="lang:powershell">Param
(
[ValidatePattern("^d{6}")]
[securestring]$SecurePIN
)</pre>
<h2>Extensions in _QUERY_ and _LIB_ scripts</h2>
<p>The reusability of code is always the focus of programming efforts. This also applies to PowerShell scripts.</p>
<p>From the application of PowerShell scripts, function code crystallizes practically at each of our customers, which is used in many scripts by copy & paste. This leads to extensive and hardly maintainable PowerShell code.</p>
<p>PowerShell functions are suitable to counter this problem. A PowerShell function can be used in any script as long as access to the function code is guaranteed.</p>
<p>ScriptRunner supports the use of PowerShell functions in multiple ways:</p>
<ul>
<li>As a library callable function with the <em>_LIB_</em> tag in a main script</li>
<li>As a callable function of a library with the tag <em>_LIB_</em> in a query script</li>
<li>As a directly usable function in an action</li>
<li>As a cmdlet in a self-written PowerShell module</li>
</ul>
<p>The functionality of a Script Library <em>_LIB_</em> is similar to a self-scripted PowerShell module, but without its overhead and without its inherent static.</p>
<p>A Script Library can contain a variety of functions. It is recommended that functions that are thematically close to each other be grouped together in a separate library. Make sure that a header and a param block exists within each function. This allows individual PowerShell functions in ScriptRunner to be used directly in an action.</p>
<p>To use PowerShell functions in a main script, the corresponding PowerShell option must be set in the action configuration panel, as shown in <em>Figure 3</em></p>
[caption id="attachment_15279" align="alignnone" width="857"]<a href="https://www.scriptrunner.com/en/blog/scriptrunner-2019r3/lib_in_action/" rel="attachment wp-att-15279"><img class="wp-image-15279 size-sesa_sb_content_1_1" src="https://www.scriptrunner.com/wp-content/uploads/2020/02/LIB_in_action-857x401.png" alt="Figure 3: Screenshot of the " width="857" height="401" srcset="http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-857x401.png 857w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-300x140.png 300w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-768x359.png 768w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-705x329.png 705w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-569x266.png 569w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-355x166.png 355w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-783x366.png 783w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-249x116.png 249w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-184x86.png 184w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-441x206.png 441w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-697x326.png 697w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-403x188.png 403w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-252x118.png 252w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-554x259.png 554w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-176x82.png 176w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-630x294.png 630w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-131x61.png 131w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-312x146.png 312w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-494x231.png 494w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action-675x315.png 675w, http://scriptrunner.online/wp-content/uploads/2020/02/LIB_in_action.png 888w" sizes="(max-width: 857px) 100vw, 857px" /></a> Figure 3: The PowerShell execution option for preloading library scripts into the session of an action can be found in the configuration panel of the action[/caption]
<p>If individual functions of a specific library are to be used in a query script, this library can be selected in the query settings (see figure 4).</p>
[caption id="attachment_15286" align="alignnone" width="808"]<a href="https://www.scriptrunner.com/en/?attachment_id=15286"><img class="wp-image-15286 size-entry_with_sidebar" src="https://www.scriptrunner.com/wp-content/uploads/2020/02/LIB_in_query-808x321.png" alt="Figure 4: Screenshot of the " width="808" height="321" /></a> Figure 4: The script execution option for preloading library scripts into the session of a query can be found in the configuration panel of the query[/caption]
<p>If you want to use a PowerShell function from a library directly as an action, you can select the function in the main menu <em>Scripts | Cmdlets</em> and create a new action by clicking<em> + New Action</em> (as shown in figure 5).</p>
[caption id="attachment_15288" align="alignnone" width="753"]<a href="https://www.scriptrunner.com/en/blog/scriptrunner-2019r3/func_as_action/" rel="attachment wp-att-15288"><img class="wp-image-15288 size-entry_with_sidebar" src="https://www.scriptrunner.com/wp-content/uploads/2020/02/FUNC_as_action-753x321.png" alt="Figure 4: Screenshot of the " width="753" height="321" /></a> Figure 5: Create a new action based on a PowerShell function by selecting the according function and clicking "+ Create" in the toolbar[/caption]
<h2>Enhancements to the Web Service Connector</h2>
<p>The number of application scenarios of the <a href="https://www.scriptrunner.com/en/software/connectors/web-service-connector/">Web Service Connector</a> is constantly increasing for our customers. This is accompanied by new requirements for using Micro Service as a caller of ScriptRunner actions.</p>
<p>For a better understanding of the different deployment scenarios with ScriptRunner here is a short overview:</p>
<h3>System or application backend</h3>
<p>ScriptRunner is called via the connector by another backend system. Source systems can be central monitoring systems or application servers, such as workflow systems. Individual service accounts or groups can be configured to authenticate the call to the ScriptRunner server and to assign the actions.</p>
<h3>Client application or client computers</h3>
<p>Client applications or client computers can use the Web Service in ScriptRunner directly. Only groups in the Self-Service End User role can be used to authenticate the call on the ScriptRunner server and to assign the actions. The referenced AD groups can contain user accounts or machine accounts.</p>
<h3>Micro services</h3>
<p>For reasons of scalability and reliability, micro services are becoming increasingly popular. In combination with ScriptRunner as automation platform for PowerShell, new possibilities for the use of scripts arise. Therefore, the possibility of using Micro Services/Kubernetes as a calling source system for ScriptRunner was introduced (see figure 6). <strong>A separate license is required for this.</strong></p>
[caption id="attachment_15290" align="alignnone" width="857"]<a href="https://www.scriptrunner.com/en/blog/scriptrunner-2019r3/microservices/" rel="attachment wp-att-15290"><img class="wp-image-15290 size-sesa_sb_content_1_1" src="https://www.scriptrunner.com/wp-content/uploads/2020/02/microservices-857x394.png" alt="Figure 5: A screenshot of the " width="857" height="394" srcset="http://scriptrunner.online/wp-content/uploads/2020/02/microservices-857x394.png 857w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-300x138.png 300w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-1030x474.png 1030w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-768x353.png 768w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-705x324.png 705w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-569x262.png 569w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-355x163.png 355w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-783x360.png 783w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-249x114.png 249w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-890x409.png 890w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-184x85.png 184w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-441x203.png 441w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-697x320.png 697w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-954x439.png 954w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-403x185.png 403w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-252x116.png 252w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-554x255.png 554w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-176x81.png 176w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-630x290.png 630w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-131x60.png 131w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-312x143.png 312w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-494x227.png 494w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices-675x310.png 675w, http://scriptrunner.online/wp-content/uploads/2020/02/microservices.png 1157w" sizes="(max-width: 857px) 100vw, 857px" /></a> Figure 6: In order to use Micro Services/Kubernetes as a calling source system for ScriptRunner, the according option has to be selected in the Web Service Connector properties panel[/caption]
<h3>Authentication with Basic Auth</h3>
<p>Calls to ScriptRunner by third party systems are always authenticated. Authentication is performed by application roles in ScriptRunner. The application roles themselves are linked to AD groups or directly to AD accounts.
A number of systems, especially Web applications, do not support all modern authentication methods. Although obsolete, Basic Auth is still frequently used by these applications.</p>
<p>To use Basic Auth on the ScriptRunner Web Service Connector, it must be enabled for Basic Auth. You do this by using a cmdlet of the <em>ScriptRunnerSettings</em> module.</p>
<ul>
<li><em>Set-AsrSTSOptions -AuthMode WINBasic -ON</em> enables Basic Auth for the connector. Username and password of the caller account must exist in AD.</li>
<li><em>Set-AsrSTSOptions -AuthMode WINBasic -BasicLocalAccounts 1 -ON</em> enables Basic Auth for the connector. Username and password must exist as local user on the ScriptRunner server.</li>
</ul>
<h2>Further improvements and enhancements</h2>
<p>In addition to the major features mentioned above, improvements and enhancements have been made in many areas.</p>
<h3>Functions for license management</h3>
<p>The PowerShell module ScriptRunnerSettings has been extended with some functions for license management.</p>
<ul>
<li>With <em>Get-AsrLicensedUser -UserType 'Self-Service Users' </em>you can now query the registered Self-Service User Accounts. If an account is not used for a longer period of time, the license is automatically released.</li>
<li>Locked accounts of administrators and service desk users can now be reactivated with a specifically requested key. A separate one-time key is required for each account. For example:</li>
</ul>
<pre class="lang:powershell">Enable-AsrLicensedUser -ExactLicensedUserString 'asrmarion.mueller' -ActivationKey XXXX</pre>
<h3>Password Connector improvements for CyberArk and Thycotic</h3>
<ul>
<li>The data formats for querying credential references for users and computer accounts have been expanded to include additional capabilities offered by CyberArk.</li>
<li>The Password Connector for Thycotic Secret Server now supports Thycotic Secret Server Cloud in addition to the on-prem variant.</li>
</ul>
<h3>Customization features for the Admin Web App</h3>
<p>The adjustments to the own corporate CI already known from the Delegate Web App have been extended to the Admin Web App with this version. The adjustments are made in the same way as for the Delegate Web App in the directory
[code]C:\ProgramFiles\ScriptRunner\WebApps\AdminApp\custom

 

New ActionPacks

We are constantly expanding our existing ActionPacks with new sample scripts. In addition, we are adding new collections to them. The following ActionPacks have been added:

 

Related posts

2 min read

VMUG Webcast: Mastering VMware Management with PowerCLI

3 min read

Automate your spring cleaning with PowerShell

5 min read

Mastering PowerShell with Get-Help

About the author: