Skip to main content
Skip table of contents

Scripts

Overview

Scripts are executed on session hosts from the system context, with system permissions. Hydra provides several built-in variables about the host pool, session hosts, and more. Advanced operations, such as those connecting to other services, can be achieved by using a PowerShell credential object (PSC).

Creating a Script

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

Frame 1401.png

Hydra has several built-in scripts ready for use. For example, scripts that can

  1. Install Windows Updates to the OS

  2. Remove a device from Entra ID

  3. Apply OS optimizations.

Frame 1402.png
  1. Click the Show Details button to open the Code pane and review the 1st Template script.

Frame 1403.png
  1. After review, click the Copy Script button to clone the Template script.

Frame 1404.png

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

Frame 1405.png
  1. Click the Show Details button to show the Description and Code panes.

Frame 1406.png
  1. Click the Script name, e.g., Builtin: 1st Template Script – Copy, and input the desired name. The Scripts 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 Script. Importantly, input the desired PowerShell script into the Code block.

Frame 1407.png

Below is an example Script that will output basic Processor information to the Hydra console:

Frame 1408.png

Hydra Built-in Variables

As shown, Hydra Scripts have built-in variables ready for use in a Script. Consider the following examples:

  • $global:Hydra_HostPool_Name

  • $global:Hydra_SessionHost_Name

  • $global:Hydra_Script_Name

Hydra Built-in Log Functions

In addition to built-in variables, there are two powerful Logging functions included:

  • LogWriter: Writes logs locally on the target session host in %Windir%\System32\LogFiles\Hydra.Logging.log.

  • OutputWriter: Writes logs locally on the target session host in %Windir%\System32\LogFiles\Hydra.Logging.log in addition to displaying it within the Hydra Portal.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.