Adding or editing a script

With the Velocity Console, you can create new scripts (also called tasks) or edit existing ones.

Use the Library. The Velocity Console includes pre-built scripts. These scripts were developed by Ivanti's technicians and field engineers to address specific and real-world needs. Use the scripts as they come, or make your own modifications to tailor it for your organization.

Do it yourself. Build the script code from scratch using the Velocity Console.

Download the Velocity Console from the Velocity downloads page. For more information about setting up and using the Velocity Console, see the Velocity documentation.

For testing scripts, we recommend that you keep a device with the Velocity client installed connected to the computer you're running the Velocity Console on for easy deployment and script execution. Your test device(s) should run the same OS as the devices in production.

The Velocity Console allows users to import existing scripts and export scripts you've created in the Console. This allows you to share scripts in more than one project and move a script from one project to another. These files are formatted with the .wlxjs extension.

In the Velocity Console, click the Advanced Configuration button to access the Tasks page. The following options are available when you create or edit a script in the Console. The names, version, tags, and description are available on the Details tab, and the parameters, resources, and script are on the Tasks page.

Display Name

The name of the script that users will see on the Tasks page.

Function Name

The name of the function. This value cannot contain spaces or other special characters, and it must be unique from other functions.

Version

The version number of the script. This can be formatted with or without decimals, such as 1 or 1.0.

Tags

Associates tags with the script that can then be used to filter scripts similar in purpose or application. Each tag should be separated by a comma. Tags entered here are displayed as filtering options from the Tasks page.

Description

Provides a short overview of the script's intended behavior, along with any other relevant information. This field has no character limit.

Parameters

A list of all associated parameters. These can be edited and added to scripts as needed. You can hard-code parameters into the script itself without having to enter parameters. However, we recommend using this functionality as it allows for cleaner scripting and the ability to change parameters based on their session, screen, or field scope. For more information, see Managing script parameters. If you change an existing parameter or add new parameters, these values can be reset from the Scripts page once you've saved the script.

From this pane, you can Add, Edit, and Delete parameters associated with the script.

Resources

Any resources associated with a script may be added here. This streamlines the process of referencing resources in a script, but without having to navigate to Settings > Resources to add these new files. When exporting a script, any resources listed here are bundled in the project with the script.

We recommend using this feature when developing scripts for features such as Speakeasy. You can attach .bnf files to the script, export it, and then use it with a different project or share your work with the Ivanti community.

Script

The body of the script, containing all functions and parameters needed to execute the script. The parameters and variables listed here must be added to the Parameters pane. You must identify the parameters and options by name within the script body, but you aren't required to set absolute values for each of these, as it can be done from the Parameters pane on the Scripts screen based on session, screen, or field scope.

If your script references any external files, you must add it as a resource file so that it is bundled with your project when deployed.

ClosedTo add a script

1.From the Tasks page, click Create task.

2.Provide a Display Name, Function name, and Description. The Function Name cannot contain characters like spaces or symbols.

3.Click the Script tab and type the script using JavaScript. Provide any script-specific parameters by clicking Add in the Parameters list.

Add resources to the script by clicking Add in the Resources list. When you add resources to a script and include the script in a project, the resources are included in the .wldep file.

4.Click Save task to save the script.

The script must now be linked to a scope. For more information, see Understanding scopes. After you have linked it to a scope, you can edit the parameters. For information on editing the parameters associated with a script, see Managing script parameters.

ClosedTo add a script from the script library

1.From the Tasks page, click Library.

2.Select the scripts you want to add and click Add.

3.The scripts are added to the project and display in the Scripts pane.

The script must now be linked to a scope. For more information, see Understanding scopes. After you have linked it to a scope, you can edit the parameters. For information on editing the parameters associated with a script, see Managing script parameters.

ClosedTo edit a script

1.From the Tasks page, select the checkbox next to the script you want to alter and then click Edit.

2.Edit changes to the name, version, tags, scope, and description on the Details tab.

Click on the Script tab to make changes to the parameters, resources, or the script text.

3.When you have finished editing the script, click Save task to save your changes.

ClosedTo import a script from another project

1.From the Advanced Configuration screen, click Import/Export, select Import, and browse for the .wlxjs file you wish to import.

2.Click Open. The script appears in the list of available scripts.

ClosedTo export a script to use in another project

1.From the Advanced Configuration screen, select the scripts you want to export and click Import/Export > Export.

2.Provide a name for the script file and click Save.