2.8.3. Agent Scripts

An agent script will be executed on the hosts that match a certain policy. To create an agent script, go to ON CMDB -> Agent -> Agent Scripts. You will see the following configuration view:

../../_images/flow-agentscript.png


All the scripts created to be running on an agent are in this view. We can Add new script, Edit a created script, or Delete a script. To create an agent script, we need the following information:

../../_images/flow-agentscript-addnew.PNG


Type: You can select the language of the script.

../../_images/flow-agentscript-addnew-type.png


There are three options: cscript language, cmd language, and powershell language.

Key: You can add the name of the script.

Processes that will execute the script: You can select the processes that will execute the script.

../../_images/flow-agentscript-addnew-processes.png


Impersonate: You can select weather the script will be executed by the system, or by the user logged in.

Script: Code with the language we have selected.

../../_images/flow-agentscript-addnew-example.png


For example, here there is a script that searches a file called LogDir in the path entered. The -ErrorAction Ignore is important to avoid problems when the file does not exist.