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:

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:
Type: You can select the language of the script.

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.

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.

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.