$SRXEnv Environment Variable

Using the ScriptRunner Environment Variable $SRXEnv

You can use the ScriptRunner PowerShell Host Environment Variable $SRXEnv for test and development purposes.

If an SMTP server is available, the ScriptRunner service can send email notifications containing execution reports, on error or on success.

The Cmdlet Reset-SRXEnvironment is used to reset the SRXEnv variable. (This Cmdlet is not available in the ScriptRunner PowerShell Host.)

The SRXEnv hashtable provides the following keys: 

Key Type Description
string Recipient email addresses (comma separated list), the full action report will be sent to these addresses.
string Recipient email addresses (comma separated list), only the ResultMessage will be sent to these addresses.
ArrayList A scripted query must specify this list of string values. The list is associated with the corresponding action parameter.

A scripted query can specify this optional list of display names. The list appears as drop-down list for the associated action parameter.

If the list is empty, the values of the ResultList list also used for display.

string This message will show in the reports, and in the immediate result window of the Delegate and Self-Service App.
string Contains the html for the Html representation of the report.
This HTML can be easily retrieved from
the ScriptRunner Apps/WebApps.
string The script can now provide (simple) structured result data by writing a (small) JSON string to $SRXEnv.ResultObjectJSON.
ScriptRunner will provide this JSON string in the OutSerializedPSObjects report field, for post-processing by the caller of the Web Service Connector.
DateTime The timestamp of the start of the script execution. (readonly)
string The user account that requested the execution of the script. (readonly)
string IP address of the client that sent the request to perform the script execution. (readonly)
string Name of the application that started the execution of the script. (readonly)
string Reason for execution written by the user

You can find the latest version here: SRXEnv in the PowerShell Galery

This page has been automatically translated and may contain grammatical errors or inaccuracies