> 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/comandos-de-powershell/invoke-psuscript.md).

# Invoke-PSUScript

Invoke-PSUScript inicia un nuevo trabajo para ejecutar un script en PowerShell Universal y devuelve un trabajo cuyo progreso y salida puede seguir.

## SINOPSIS

Inicia un nuevo trabajo de PowerShell Universal para un script.

## SINTAXIS

```powershell
Invoke-PSUScript -Script <Script> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
Invoke-PSUScript -Id <Int64> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
Invoke-PSUScript -Name <String> [-Environment <String>] [-Credential <Variable>] [-Notes <String>] [-WaitForDebugger] [-Wait] [-WaitTimeout <Int32>] [-Queue <String>] [-Parameters <Hashtable>] [-Tags <Tag[]>] [-Silent] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`. Los parámetros de script también se exponen de forma dinámica cuando es posible.

## DESCRIPCIÓN

Inicia un trabajo del que se puede hacer un seguimiento con los cmdlets de trabajos. Seleccione un script por nombre, Id u objeto de script (que acepta la entrada de la canalización). Los parámetros de script normales se exponen de forma dinámica. Los parámetros de script ocultos no se exponen deliberadamente como parámetros dinámicos del cmdlet, pero se pueden suministrar mediante la tabla hash `-Parameters` y se pasan al script. Aquí, `-Credential` es una *variable* de credencial de PSU para el trabajo, no un `PSCredential` para la autenticación de la API de administración.

## EJEMPLO

```powershell
Invoke-PSUScript -Name 'Deploy.ps1' -Parameters @{ Region = 'westus'; InternalToken = $token }
```

## PARÁMETROS

| Parámetro                | Descripción                                                                                         |
| ------------------------ | --------------------------------------------------------------------------------------------------- |
| `-Script`                | Objeto de script que se ejecuta; acepta la entrada de la canalización.                              |
| `-Id`                    | Id numérico del script que se ejecuta; acepta la entrada de la canalización.                        |
| `-Name`                  | Nombre o ruta del script que se ejecuta.                                                            |
| `-Environment`           | Reemplazo del entorno de ejecución (alias `-PowerShellVersion`).                                    |
| `-Credential`            | Variable de credencial de PSU utilizada para el trabajo.                                            |
| `-Notes`                 | Notas almacenadas con el trabajo.                                                                   |
| `-WaitForDebugger`       | Espera un depurador antes de que se ejecute el trabajo.                                             |
| `-Wait`                  | Espera a que el trabajo termine.                                                                    |
| `-WaitTimeout`           | Tiempo de espera, en segundos.                                                                      |
| `-Queue`                 | Cola de trabajos o grupo de ordenadores (alias `-ComputerGroup`).                                   |
| `-Parameters`            | Tabla hash de los valores de los parámetros del script, incluidos los parámetros de script ocultos. |
| `-Tags`                  | Etiquetas que se adjuntan al trabajo.                                                               |
| `-Silent`                | Suprime la salida de ejecución en la canalización actual.                                           |
| `-ComputerName`          | URL o nombre de host del servidor PSU de destino (alias `-Uri`).                                    |
| `-AppToken`              | Token de aplicación para la API de administración.                                                  |
| `-UseDefaultCredentials` | Usa las credenciales actuales de Windows.                                                           |
| `-Integrated`            | Usa el cliente de administración en proceso dentro de PSU.                                          |
| `-TrustCertificate`      | Ignora los errores de validación del certificado.                                                   |
| `-Cookies`               | Reutiliza las cookies de autenticación para esta sesión de PowerShell.                              |

## PERMISOS

El token de acceso requiere `automation.scripts.<script path>/execute` para ejecutar este cmdlet de forma remota. Cargar los parámetros del script también requiere `automation.scripts.<script path>/read`. Buscar el script puede requerir además `automation.scripts/read` o `automation.scripts.<name>/read` al usar `-Name`. Sin `-Wait`, leer el nuevo trabajo requiere `automation.jobs.<job ID>/read` o el ReadPermission configurado del trabajo.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/es/comandos-de-powershell/invoke-psuscript.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
