Breadcrumbs

Script Collections

Creating a Script Collection

  1. In the left-side menu from the main Dashboard, click Scripts and Collections and then Collections.

Frame 1409.png

Hydra has several built-in Collections ready for use. For example, Collections that can Install Windows Updates.

Frame 1410.png
  1. Click the Show Details button to open the Code pane and review the 1st Template Script Collection. This is meant to be cloned and modified, so there isn’t much information here.

Frame 1411.png
  1. After reviewing, click the Copy Script Collection button.

Frame 1412.png

By default, the name of the cloned script will be Builtin: 1st Template Script – Copy. Also, the Script Collection will be added to the bottom of the table.

Frame 1413.png
  1. Click the Collection name, e.g., Builtin: 1st Template Script Collection – Copy, and input the desired name. The Collections table has a search bar, so consider using a naming convention to group scripts based on what they do, or where they run.

    1. Optionally, add a Description with an overview of the Collection’s purpose, workflow, and error-handling.

Frame 1414.png

Modifying a Script Collection

Once a Collection has been cloned, there is an inevitable configuration. For each added Action in the Collection, there are a few options:

  1. Click the Show details button to open the Parameters field:

Frame 1415.png
  1. Click the Add button to add a new script or action.

Frame 1416.png
  1. Click the Delete button of a given step to remove that step.

Frame 1417.png
  1. Click the Down (or Up) arrow to move a step down (Up) in the sequence.

Frame 1418.png

Performing Action on Script Collection Error

Hydra has built-in error handling for Script Collections. To configure an Action or Script to trigger On Error:

  1. Underneath the Actions and Scripts section of the Collection, find the On Error – Actions and Scripts section

  2. Click the Add button.

Frame 1419.png
  1. Choose an appropriate Action or Script to execute On Error. Here are a few built-in examples: Run a Custom or Built-in Script, VM – Start, VM – Deallocate, VM – Delete.

Below is a basic example of the Script Collection configuration:

Frame 1420.png

Parameters

Certain Script Collection actions have special parameters that can be utilized, and some even require them. For example, the VM Disk - Resize action requires a resize amount to be specified. Select the first icon on the right side to show the Parameters text box, and then specify the parameter:

Frame 1976.png

Scripts can also utilize these parameters. This can be useful to maintain the same parent script, but then utilize different Script Collections for parameter adjustments. You would simply add a param section at the top of the PowerShell script with the data type, like below:

param(

  [string] $Mode,
  
  [bool] $DoNotRestart = $false,
  
  [string] $LogDir = "$env:windir\system32\logfiles"

)

In the Parameters box for the Script action in the Script Collection, you can then specify the parameters:

Frame 1975.png