> 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/it/comandi-powershell/new-psuenvironment.md).

# New-PSUEnvironment

New-PSUEnvironment crea un ambiente di esecuzione PowerShell in PowerShell Universal, definendo il runspace, i moduli e lo script di avvio.

## SINOSSI

Crea un ambiente di esecuzione di PowerShell Universal.

## SINTASSI

```powershell
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>] [-RunspaceSaturationWarningThresholdPercent <Int32>] [-RunspaceSaturationWarningDurationSeconds <Int32>] [-RecycleSchedule <String>] [-Credential <Variable>] [-Description <String>] [-DisableImplicitWinCompat] [-Minimal] [-Disabled] [-ProcessStartupScript <String>] [-EnableDebugger] [-Verb <String>] [-PowerShellVersion <String>] [-Virtual] [-ContainerImageUrl <String>] [-ContainerImageTag <String>] [-ContainerPull] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`. Qui `-Credential` è una variabile di credenziale PSU per l'esecuzione, non una credenziale dell'API di gestione.

## DESCRIZIONE

Crea un ambiente per API, script, app e processi di sicurezza. `-Type` accetta `Custom`, `WindowsPowerShell`, `PowerShell7`, `Isolated` o `Container`. Per `Isolated`, `-PowerShellVersion` accetta una versione installata o un selettore multi-pwsh come `stable`, `preview`, `lts` o `7.4`; `-Virtual` abilita un ambiente virtuale multi-pwsh gestito. Le opzioni del contenitore configurano l'URL dell'immagine, il tag e se estrarre l'immagine. `-EnableDebugger` è mantenuto per compatibilità, ma non è più obbligatorio ed emette un avviso.

## ESEMPIO

```powershell
New-PSUEnvironment -Name 'Isolated 7.4' -Type Isolated -PowerShellVersion '7.4' -Virtual
```

## PARAMETRI

| Parametro                                    | Descrizione                                                                                       |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `-Name`                                      | Nome dell'ambiente obbligatorio.                                                                  |
| `-Version`                                   | Identificatore di versione dell'ambiente; per impostazione predefinita, il suo nome.              |
| `-Type`                                      | Tipo di ambiente: `Custom`, `WindowsPowerShell`, `PowerShell7`, `Isolated` o `Container`.         |
| `-Path`                                      | Percorso dell'eseguibile dell'ambiente.                                                           |
| `-Arguments`                                 | Argomenti di processo aggiuntivi.                                                                 |
| `-Modules`                                   | Moduli configurati per l'ambiente.                                                                |
| `-Variables`                                 | Nomi delle variabili PSU disponibili per l'ambiente; il valore predefinito è `*`.                 |
| `-PSModulePath`                              | Percorsi di moduli di PowerShell aggiuntivi.                                                      |
| `-StartupScript`                             | Script da eseguire all'avvio dei runspace.                                                        |
| `-PersistentRunspace`                        | Abilita un runspace persistente.                                                                  |
| `-RunspaceRecycling`                         | Abilita il riciclo dei runspace.                                                                  |
| `-MaxRunspaces`                              | Numero massimo di runspace (25 per impostazione predefinita).                                     |
| `-MaxVirtualMemory`                          | Memoria virtuale massima in MB; convertita in byte per l'archiviazione.                           |
| `-RunspaceSaturationWarningThresholdPercent` | Percentuale della soglia di avviso di saturazione dei runspace (80 per impostazione predefinita). |
| `-RunspaceSaturationWarningDurationSeconds`  | Durata dell'avviso di saturazione, in secondi (30 per impostazione predefinita).                  |
| `-RecycleSchedule`                           | Pianificazione per il riciclo dei runspace.                                                       |
| `-Credential`                                | Variabile di credenziale PSU per l'esecuzione, non un `PSCredential` dell'API di gestione.        |
| `-Description`                               | Descrizione dell'ambiente.                                                                        |
| `-DisableImplicitWinCompat`                  | Disabilita la compatibilità Windows implicita.                                                    |
| `-Minimal`                                   | Abilita un avvio minimo dell'ambiente.                                                            |
| `-Disabled`                                  | Crea l'ambiente disabilitato.                                                                     |
| `-ProcessStartupScript`                      | Script eseguito all'avvio del processo.                                                           |
| `-EnableDebugger`                            | Commutatore di compatibilità legacy; ora emette solo un avviso.                                   |
| `-Verb`                                      | Verbo usato per avviare l'eseguibile.                                                             |
| `-PowerShellVersion`                         | Versione di PowerShell installata o selettore multi-pwsh per gli ambienti isolati.                |
| `-Virtual`                                   | Abilita un ambiente virtuale gestito.                                                             |
| `-ContainerImageUrl`                         | URL dell'immagine del contenitore.                                                                |
| `-ContainerImageTag`                         | Tag dell'immagine del contenitore.                                                                |
| `-ContainerPull`                             | Estrae l'immagine del contenitore configurata.                                                    |
| `-ComputerName`                              | URL o nome host del server PSU di destinazione (alias `-Uri`).                                    |
| `-AppToken`                                  | Token dell'app dell'API di gestione.                                                              |
| `-UseDefaultCredentials`                     | Usa le credenziali Windows correnti.                                                              |
| `-Integrated`                                | Usa il client di gestione nel processo.                                                           |
| `-TrustCertificate`                          | Ignora gli errori di convalida del certificato.                                                   |
| `-Cookies`                                   | Riutilizza i cookie di autenticazione della sessione.                                             |

## AUTORIZZAZIONI

Il token di accesso richiede `settings.environments/create` per eseguire questo cmdlet in remoto.


---

# 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/it/comandi-powershell/new-psuenvironment.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.
