# Deploying agents via GPO

## Prerequisites

Here are the prerequisites that will permit deployment of GLPI agents with a GPO:

* Create a shared folder on the network, accessible to all PCs, in which the GLPI agent executables (32bits and/or 64bits) will be placed. These are available on Github: [GLPI Agent releases](https://github.com/glpi-project/glpi-agent/releases)
* You have to download the glpi-agent-deployment.vbs VBS script which ease deployment via GPO.

## Script VBS

The latest script VBS version can directly be downloaded from the following link: [glpi-agent-deployment.vbs](https://raw.githubusercontent.com/glpi-project/glpi-agent/develop/contrib/windows/glpi-agent-deployment.vbs)

Before using this script in a GPO, you have to edit the few configuration lines at the beginning of the script.

In this file, the following lines then need to be adapted:

* Line 67: GLPI Agent version to be installed. It has to be update in the case agent version is changing.

  ```
  SetupVersion = "1.12"
  ```
* Line 91: Indicates the path to the shared folder containing the agent MSI packages: For example:

  ```
  SetupLocation = "\srv-fileglpiinventory"
  ```
* Line 112 : Agent installation options Example for **GLPI 10** with native inventory support:

  ```
  SetupOptions = "/quiet RUNNOW=1 ADD_FIREWALL_EXCEPTION=1 SERVER='http://glpi.yourcompany.com/front/inventory.php' TAG=MONTAG TASKS=inventory,deploy,collect,inventory"
  ```

Here is a list of common attributes:

```
- RUNNOW : Launch an inventory just after installation

- ADD_FIREWALL_EXCEPTION : Adds the GLPI agent to the Windows firewall exception list.

- SERVER : agent contact address on the GLPI server

- TAG: Adds the "TAG" tag to agents.

- TASKS: Allows you to manage the order of tasks to be carried out by the agent.
```

The full list of options is available here: [Windows installer command line parameters](https://glpi-agent.readthedocs.io/en/latest/installation/windows-command-line.html)

The rest of the script does not need to be modified.

## Creating the GPO

The GPO to be created must have the following parameters:

* Type Computer
* Startup script (where we will give the path to the vbs script mentioned above)

Full documentation is also available at this address :

* <https://glpi-agent.readthedocs.io/en/latest/index.html>

## Options

***

### Add authentication with user and password.

This option must be requested via the cloud support form if you are a [GLPI Network Cloud](https://glpi-network.cloud/fr) customer. Once this has been set up on the server side, you will be provided with a user and password. Then you'll be able to use them in agents configuration.

Then you'll have to add `USER=` and `PASSWORD=` options to options line like in the following example:

```
SetupOptions = "/quiet RUNNOW=1 ADD_FIREWALL_EXCEPTION=1 SERVER='http://glpi.yourcompany.com/marketplace/glpiinventory/' TAG=MONTAG TASKS=inventory,deploy,collect,inventory USER=MONUSER PASSWORD=MONPASS"
```

## Reference

* Public GLPI Agent documentation: <https://glpi-agent.readthedocs.io/en/latest/index.html>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.glpi-project.org/tutorials/inventory/deploy_agent_gpo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
