> 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/new-psuvariable.md).

# New-PSUVariable

New-PSUVariable crea una nueva variable en PowerShell Universal, que se puede almacenar opcionalmente como secreto, valor de base de datos o limitada a roles específicos.

## SINOPSIS

Crea una variable de PowerShell Universal.

## SINTAXIS

```powershell
New-PSUVariable -Name <String> [-Value <Object>] [<VariableOptions>] [<ConnectionOptions>]
New-PSUVariable -Name <String> [-InputObject <Object>] [<VariableOptions>] [<ConnectionOptions>]
New-PSUVariable -Name <String> -Vault <String> [-Value <Object>] [-InputObject <Object>] [<VariableOptions>] [<ConnectionOptions>]
```

`<VariableOptions>`: `[-Type <String>] [-Description <String>] [-DisableRunAsSupport] [-Database] [-Required] [-Role <String[]>] [-Force] [-Scope <VariableScope>] [-Tag <Tag[]>] [-PasswordNotRequired]`. `<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`.

## DESCRIPCIÓN

Crea una variable disponible para los scripts de PSU. `-InputObject` sin `-Vault` serializa su valor como `PSObject`; en el conjunto de parámetros Secret, `-InputObject` se acepta, pero no se convierte en el `-Value` almacenado. Un `PSCredential` suministrado mediante `-Value` almacena su nombre de usuario y su contraseña con el tipo `PSCredential`. Los nombres de variable existentes (sin distinguir mayúsculas de minúsculas) se rechazan, a menos que se indique `-Force`. `-Required` marca una variable como obligatoria, lo que pueden usar los requisitos de módulos del entorno para que un módulo no se considere listo hasta que la variable esté disponible.

## EJEMPLO

```powershell
New-PSUVariable -Name 'ApiKey' -Required -Description 'API key required by the integration'
```

## PARÁMETROS

| Parámetro                | Descripción                                                                                      |
| ------------------------ | ------------------------------------------------------------------------------------------------ |
| `-Name`                  | Nombre de variable único y obligatorio.                                                          |
| `-Value`                 | Valor que se almacena; los valores de cadena se pueden deserializar desde CLIXML.                |
| `-InputObject`           | Objeto serializado como `PSObject` solo en el conjunto de parámetros InputObject (sin `-Vault`). |
| `-Vault`                 | Nombre del almacén de secretos para el conjunto de parámetros Secret.                            |
| `-Type`                  | Tipo de la variable, `System.String` de forma predeterminada cuando ningún valor lo sustituye.   |
| `-Description`           | Descripción de la variable.                                                                      |
| `-DisableRunAsSupport`   | Desactiva el uso como credencial de ejecución.                                                   |
| `-Database`              | Almacena el valor en la base de datos.                                                           |
| `-Required`              | Marca la variable como obligatoria.                                                              |
| `-Role`                  | Roles con permiso para acceder a la variable.                                                    |
| `-Force`                 | Permite la creación cuando el nombre ya existe.                                                  |
| `-Scope`                 | Ámbito de la variable.                                                                           |
| `-Tag`                   | Etiquetas de la variable.                                                                        |
| `-PasswordNotRequired`   | Marca la contraseña de una credencial como no obligatoria.                                       |
| `-ComputerName`          | URL o nombre de host del servidor PSU de destino (alias `-Uri`).                                 |
| `-AppToken`              | Token de aplicación de la API de administración.                                                 |
| `-Credential`            | Credenciales de la API de administración.                                                        |
| `-UseDefaultCredentials` | Usa las credenciales actuales de Windows.                                                        |
| `-Integrated`            | Usa el cliente de administración en proceso.                                                     |
| `-TrustCertificate`      | Ignora los errores de validación del certificado.                                                |
| `-Cookies`               | Reutiliza las cookies de autenticación de la sesión.                                             |

## PERMISOS

El token de acceso requiere `platform.variables/create` para ejecutar este cmdlet de forma remota.


---

# 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/new-psuvariable.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.
