> 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-psuenvironment.md).

# New-PSUEnvironment

## SINOPSIS

Crea un nuevo entorno de PowerShell Universal.

## SINTAXIS

```
New-PSUEnvironment -Name <String> [-Version <String>] [-Type <EnvironmentType>] [-Path <String>]
 [-Arguments <String>] [-Modules <String[]>] [-Variables <String[]>] [-PSModulePath <String[]>]
 [-StartupScript <String[]>] [-PersistentRunspace] [-RunspaceRecycling] [-MaxRunspaces <Int32>]
 [-MaxVirtualMemory <Int64>] [-RecycleSchedule <String>] [-Credential <Variable>] [-Description <String>]
 [-DisableImplicitWinCompat] [-Minimal] [-Disabled] [-ProcessStartupScript <String>] [-EnableDebugger]
 [-Verb <String>] [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated]
 [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

## DESCRIPCIÓN

Los entornos definen entornos de ejecución de PowerShell dentro de PowerShell Universal. Puede utilizarlos al ejecutar APIs, scripts, dashboards y los procesos de seguridad para la autenticación y la autorización.

Los entornos se almacenan en el fichero ./universal/environments.ps1.

También puede utilizar este cmdlet para crear entornos a través de la API REST.

## EJEMPLOS

### Ejemplo 1

```powershell
PS C:\> New-PSUEnvironment -Name '7.1' -Path 'pwsh.exe'
```

Crea un nuevo entorno llamado 7.1 que utiliza pwsh.exe para ejecutar APIs, scripts o dashboards.

### Ejemplo 2

```powershell
PS C:\> New-PSUEnvironment -Name '7.1' -Path 'pwsh.exe' -ArgumentList "-ExecutionPolicy Bypass"
```

Crea un nuevo entorno llamado 7.1 que utiliza el ejecutable pwsh.exe y establece la política de ejecución en ByPass.

### Ejemplo 3

```powershell
PS C:\> New-PSUEnvironment -Name '7.1' -Path 'pwsh.exe' -ArgumentList "-ExecutionPolicy Bypass" -Variables @("*")
```

Crea un nuevo entorno que utiliza todas las variables definidas con New-PSUVariable.

### Ejemplo 4

```powershell
PS C:\> New-PSUEnvironment -Name '7.1' -Path 'pwsh.exe' -ArgumentList "-ExecutionPolicy Bypass" -Modules @("ActiveDirectory")
```

Crea un nuevo entorno que carga automáticamente el módulo ActiveDirectory.

### Ejemplo 5

```powershell
PS C:\> New-PSUEnvironment -Name '7.1' -Path 'pwsh.exe' -ArgumentList "-ExecutionPolicy Bypass" -PersistentRunspace
```

Crea un nuevo entorno que utiliza runspaces persistentes. Los runspaces persistentes se utilizan para APIs y no se restablecen entre cada ejecución.

## PARÁMETROS

### -AppToken

El AppToken que se utiliza para llamar a la API de gestión de PowerShell Universal. También puede llamar a Connect-PSUServer antes de llamar a este cmdlet para establecer el AppToken para toda la sesión.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Arguments

Argumentos que se pasan al proceso de PowerShell al iniciar el entorno.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

Especifica el nombre del ordenador o la URL a la que se debe llamar al acceder a la API de gestión de PowerShell Universal. También puede utilizar Connect-PSUServer antes de llamar a este cmdlet para establecer el nombre del ordenador para toda la sesión.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Modules

Módulos que se cargan automáticamente al crear nuevos runspaces en el entorno.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name

El nombre del entorno.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PSModulePath

Rutas adicionales que se añaden al PSModulePath para el entorno.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Path

La ruta al ejecutable de PowerShell.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -PersistentRunspace

Si se habilitan los runspaces persistentes. Esto solo se utiliza para APIs.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Variables

Variables que se importan al runspace. Estas son variables definidas por New-PSUVariable.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UseDefaultCredentials

Utilizar las credenciales predeterminadas al conectarse a la API de gestión

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Integrated

Ejecuta el comando internamente en lugar de utilizar la API de gestión. Solo funciona al ejecutar el script desde dentro de PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -StartupScript

Un script que se ejecuta al crear los runspaces en este entorno.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Version

Un número de versión que mostrar.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RunspaceRecycling

Si se reciclan los runspaces. Los runspaces se reciclarán (se eliminarán y se volverán a crear) después de un tiempo determinado o de un número de usos.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -MaxRunspaces

El número máximo de runspaces que se crean para este entorno.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -EnableDebugger

Habilita la función de depuración de PowerShell para este entorno.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

La credencial que se utiliza con este entorno

```yaml
Type: Variable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -MaxVirtualMemory

La memoria virtual máxima en bytes. Cuando se alcanza el umbral, el proceso se reinicia. Se ignora para el entorno integrado.

```yaml
Type: Int64
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RecycleSchedule

Una programación CRON para reiniciar este entorno. Se ignora para el entorno integrado.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Description

Una descripción para este entorno.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DisableImplicitWinCompat

Deshabilita el modo de compatibilidad implícita de Windows PowerShell.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Minimal

Un entorno mínimo que no carga ningún módulo ni variable.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ProcessStartupScript

Un script que se ejecuta una vez cuando se inicia el proceso. No se ejecuta para cada runspace.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Disabled

El entorno está deshabilitado.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Si el cmdlet debe ignorar los problemas de certificado.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Type

El tipo de entorno. Se admiten PowerShell 7 y Windows PowerShell 5.1. Utilice Custom para crear un entorno personalizado

```yaml
Type: EnvironmentType
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Verb

El verbo que se utiliza al crear el proceso para este entorno. No se utiliza para el entorno integrado.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Reutiliza y conserva las cookies de autenticación para la sesión actual de PowerShell.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

Este cmdlet admite los parámetros comunes: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable y -ProgressAction. Para más información, consulte [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## ENTRADAS

### Ninguna

## SALIDAS

### System.Object

## NOTAS

## ENLACES RELACIONADOS

[New-PSUVariable](/powershell-universal/es/comandos-de-powershell/new-psuvariable.md)


---

# 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/comandos-de-powershell/new-psuenvironment.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.
