Executing Scripts

You can execute a script only after it is approved. A new job is created when you execute a script and is listed under the Jobs tab.

To know more on how to approve a script, refer to Reviewing and Approving Scripts.

You may also want to test the script before executing. To know more about script test, refer to Testing Scripts.

Reboot lets you reboot the host and allow the script execution to come into effect. You can specify the time after which you want to start the reboot. The time buffer must be for a minimum of ten minutes and a maximum of forty-eight hours. You can set the time by choosing the duration from the drop-down menu. Reboot is applicable only for Windows scripts.

Note: Reboot takes place only if the CAR job status is 'Execution Passed'.

To execute a script:

1. In the Scripts tab, select a script and then click Quick Actions > Run Now.

The Run Now option is active only if the script is approved.

Image for Run Now option

2. In the Select Assets screen, define the scope of your script by selecting assets and/or by including asset tags.

If you want to specify assets, do the following:

- In the Include Assets section of the Select Assets page, click the + sign.

- In the Select Assets page, select the assets that you want to include in the script run and then click Apply.

If you want to include asset tags, do the following:

-  In the Include Asset Tag section of the Select Assets page, click the + sign.

- In the Select Tags page, select the tags that you want to include in the script run and then click Apply.

Note: You can add All or Any asset tags.

3. The Exclude host for the tags option is enabled only when you include asset tags. At times, you may want to exclude certain assets that are assigned to the tag that you have selected in the previous step. This option enables you to specify assets that you want to exclude in the script run.

- In the Exclude the Assets section, click the + sign.

- In the Select Assets page, select the assets that you want to exclude and then click Apply.

4. Use the Bypass Powershell Execution Policy toggle switch to specify if you want to override the PowerShell execution policy on Windows agents. When you switch this option to Yes, both signed and unsigned scripts will be executed on the agent irrespective of the PowerShell execution policy set on the asset.

Note: This option is displayed only when you execute a Windows PowerShell script.

5. You can enable the reboot by clicking on the toggle button. You can specify the duration after which the reboot will start.

6. Click Execute Script.

Note: You cannot execute the same script within a span of 5 minutes.

You can view the status of the executed script under the Jobs tab.

Execute under Jobs Tab

Unlike the evaluated scripts, the name of the executed script is displayed as it is, without any suffix or prefix.

Related Topics

Creating Scripts

Testing Scripts

Reviewing and Approving Scripts

Exporting and Importing Scripts

Scheduling a Script Execution