This section outlines the configuration that needs to be complete in your PowerShell instance to make integration with Halo possible.
First you will need to write your PowerShell scripts and make these accessible from the server where the NHServer program is being run. You should also ensure that the user running the NHServer scheduled task has the relevant permissions to run the PowerShell scripts.
You will need to declare variables in your scripts, as these will be mapped to fields in Halo, and then have their values set when the script is executed.
To begin configuring the PowerShell integration, go to Configuration > Integrations and enable the PowerShell module. Once enabled, click into the module to begin configuration.
To configure a new PowerShell script, hit the new option, or select an existing one from the list to edit.
The script name is simply used as an identifier in Halo. The location should be the path to the file on the server where the NHServer task is being run. So here, the C:\ drive is the drive of the server, and not my local machine.
The type drop down has two options, approval and action. If approval, then the script can be executed when an approval process is approved. If action, then it can be configured to run when a specific action is completed.
The custom table option can only be used if you have created custom tables in the Windows application. Choosing a custom table allows you to create mappings from fields that belong in custom tables linked to the faults table. Note that you can only map from one custom table per script.
Field mappings are used to pass values from Halo to the PowerShell script at the time of execution. For example, assume we have a variable in our PowerShell script called $username, and a custom field called CFUsername. If we map these two fields to each other, then the value of CFUsername will be passed to the $username variable when the script is run.
To add a new field mapping, put the screen in edit mode if required, and press the add button. You first need to choose which type of field you would like to map. You have the choice of some system fields from the Customer, Site, User and Ticket tables, along with any type of custom field from these tables.
Note that you will also have an additional field type of “Custom Table” if you have specified a custom table in the previous configuration steps.
When a script is run by NHServer, the application needs a way of determining whether or not the script has run successfully, so that you can be notified of any failures.
The final configuration options allow you to specify a result text. If this is matched (or partially matched), then the ticket which the script has run for can have its status changed according to the “Status after success option”. Similarly, if the script fails, it can have its status amended to a different value.
It is strongly recommended that you configure your scripts to produce an easily identifiable result, which can then be matched by the application when run.
Should a script fail, then the details of the failure, including the failure message, will be added as an action to the ticket.
Triggering the Script
Now that you have configured the script, you need to link this to either an approval process step, or an action.
To link it to an action, go to Configuration > Tickets > Actions. You need to set the system use for the action to Queue PowerShell script:
Once selected, an additional box will appear, where you can choose which script should be run when the action is performed. Only scripts that have a type of “Action” will be available.
To link a script to an approval process, go to Configuration > Tickets > Approval Processes > Setup Processes > Choose a Process > Choose which step of the process you’d like the script to be run after:
Here there is an option to choose which script you would like to be run when the approval process step is approved.