> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/es/config/agent.md).

# Agente

Los PowerShell Universal Agents proporcionan un mecanismo para ejecutar scripts en máquinas remotas sin tener que configurar PowerShell Remoting. Los agentes son servicios ligeros que alojan el SDK de PowerShell y se conectan a PowerShell Universal mediante WebSockets.

Puede aprender a enviar comandos a los agentes en la [página Event Hubs](/powershell-universal/es/api/event-hubs.md).

## Instalación

Puede obtener más información sobre la instalación del agente en nuestra [página de instalación](/powershell-universal/es/getting-started.md).

## agent.json

Después de instalar el agente, deberá configurar el cliente mediante un fichero `agent.json`. Si el fichero no existe, deberá crearlo.

Este fichero JSON configura el Agent para conectarse al hub y ejecutar scripts cuando se le invoque.

```json
{
    "Connections": [
        {
            "Url": "http://localhost:5000",
            "Hub": "eventHub",
            "AppToken": "tokenXyz",
            "ScriptPath": "script.ps1",
            "Description": "My agent"
        }
    ]
}
```

### Ubicación

#### Sistema

La ubicación de sistema de `agent.json` es `$ENV:ProgramData\PowerShellUniversal`.

#### Usuario

La ubicación específica del usuario de `agent.json` es `$ENV:AppData\PowerShellUniversal.`

### Opciones

Las siguientes opciones se pueden incluir en el fichero `agent.json`.

#### Conexiones

Estas son las conexiones a los Event Hubs. Cada conexión puede contener su propia URL, hub, autenticación y script a ejecutar.

#### URL (obligatorio)

La URL del servicio PowerShell Universal.

#### Hub (obligatorio)

El nombre del Event Hub.

#### AppToken

El token de aplicación utilizado para autenticarse contra el hub.

#### UseDefaultCredentials

Se utilizará la autenticación de Windows para autenticarse contra el hub.

#### ScriptPath

El script a ejecutar cuando se recibe un evento. Este script se lee en memoria y no desde el disco. Variables como `$PSScriptRoot` no son compatibles actualmente. Esto es opcional, ya que los event hubs también pueden ejecutar comandos directamente.

Si `ScriptPath` es una ruta relativa como `script.ps1`, el agente la resuelve en relación con el directorio de datos de PowerShell Universal. En Windows, eso significa `%ProgramData%\PowerShellUniversal\script.ps1` a menos que proporcione una ruta completamente cualificada.

#### Descripción

La descripción de esta conexión. Se comunicará al servidor de PowerShell Universal.

## Variables de entorno

Las variables de entorno se pueden utilizar para configurar diversos ajustes operativos del agente.

| Nombre                            | Descripción                                                            | Valor predeterminado |
| --------------------------------- | ---------------------------------------------------------------------- | -------------------- |
| PSU\_AgentLogLevel                | Establece el nivel de registro del servicio del agente.                | Information          |
| PSU\_Connections\_\_0\_\_Url      | La URL del servicio PowerShell Universal.                              |                      |
| PSU\_Connections\_\_0\_\_Hub      | El nombre del Event Hub al que conectarse.                             |                      |
| PSU\_Connections\_\_0\_\_AppToken | El token de aplicación utilizado para conectarse a un hub autenticado. |                      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/es/config/agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
