Skip to main content

Script library

In briefThe script library stores each script once, with a full version history, so jobs can point at it instead of carrying their own copy. A Windows - Embedded Script or UNIX - Embedded Script job runs a library script on a legacy LSAM machine. It uses a runner: the program and command template the agent starts the script with. You can add your own script types and runners next to the built-in ones.

WhereDesign › Scripts, which has three tabs: Scripts, Runners and Script Types. New Script, New Runner and New Script Type add one of each. A job picks its Script, Version, Runner and Arguments in the Job Editor, under Job Parameters.

WhenUse the script library when:

  • the same script runs in more than one job, and a fix should reach all of them;
  • you want a history of changes to a script, and the option to restore an earlier version;
  • a script needs an interpreter, or an interpreter path, that the built-in runners do not cover.

For a script that runs on a Universal Agent, use Run Script. Universal Agent jobs do not use runners.

How

  1. Create the script on the Scripts tab, choosing its Type, and save.
  2. Check there is a runner for that type on the job's platform. If there is not, add one on the Runners tab.
  3. In the job, choose the Script, then the Version (latest, or a pinned number), then the Runner.
  4. Save the workflow. A script and runner that do not go together are refused at that save.
Notes
  • A script name cannot contain spaces. Importing a file into a new, unnamed script names it after the file, with spaces turned into _, and a copy is suggested as <name>_Copy.
  • A script's type is fixed once it is created. To change it, copy the script and choose the type on the copy.
  • A pinned version keeps running until you change the job. Latest picks up every new version.
  • Runners are not versioned. An edit applies to every job that uses the runner on its next run.
  • Changing the catalog needs Scripts View plus the matching Script Catalog permission.
Watch out
  • Built-in Shell and Bash have no Windows runner, and SQL has no UNIX runner. A script with no runner for a job's platform is not offered in that job's Script list.
  • A UNIX command format is limited to 127 bytes, and $FILE and $ARGUMENTS must be exact, space-separated words.
  • A script, runner or script type that something still uses cannot be deleted.
  • If someone else saved the script while you were editing, your save is refused. Copy unsaved edits you need before you choose Reload latest, discarding my changes.