Execute 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.

If an asset job is in a pending state, no new asset job is created for that asset on the next execution of the same script within 14 days from the last execution. For more information, refer to Optimization of Asset Job Handling in CAR.

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.

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

To execute a script, follow these steps:

  1. In the Scripts tab, select a script and then click Quick Actions menu, click 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.

    When executing a parameterized script, you can modify the Script Parameters value as required.

    If you want to specify assets, follow these steps:

    If you want to include asset tags, follow these steps:

    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 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.
    • 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.

      You can add All or Any asset tags.

    • 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.
  3. Select the following toggle switch as required:
    • Bypass PowerShell Execution Policy: Use this toggle to specify if you want to override the PowerShell execution policy on Windows agents. When you switch this toggle to Yes, both signed and unsigned scripts are executed on the agent irrespective of the PowerShell execution policy set on the asset.

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

    • Reboot Host after Script Execution: If you turn this toggle to Yes and set a delay, the system waits for the selected duration after the script execution completes and then initiates the reboot process.
      The Delay before Reboot option enables you to specify a time period before the system is rebooted following the execution of a script.
      This ensures a smooth transition between the execution of the script and the reboot process, allowing you to manage system changes in a controlled and efficient manner.
    • Monitor this script’s output for any changes: Use this toggle to share the script output to monitor and detect any changes to the FIM assets and displays those changes as events in FIM.

  4. Click Execute Script.

    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