> 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/da/powershell-kommandoer/new-psuenvironment.md).

# New-PSUEnvironment

New-PSUEnvironment opretter et PowerShell-kørselsmiljø i PowerShell Universal og definerer runspacet, modulerne og opstartsscriptet.

## Synopsis

Opretter et PowerShell Universal-kørselsmiljø.

## Syntaks

```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]`. Her er `-Credential` en PSU-legitimationsoplysningsvariabel til udførelse, ikke en legitimationsoplysning til Management API.

## Beskrivelse

Opretter et miljø til API'er, scripts, apps og sikkerhedsprocesser. `-Type` accepterer `Custom`, `WindowsPowerShell`, `PowerShell7`, `Isolated` eller `Container`. For `Isolated`, `-PowerShellVersion` accepterer en installeret version eller en multi-pwsh-vælger som `stable`, `preview`, `lts` eller `7.4`; `-Virtual` aktiverer et administreret virtuelt multi-pwsh-miljø. Containerindstillinger konfigurerer image-URL'en, tagget og om det skal hentes. `-EnableDebugger` bevares af hensyn til kompatibilitet, men er ikke længere påkrævet og udsender en advarsel.

## Eksempel

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

## Parametre

| Parameter                                    | Beskrivelse                                                                                           |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `-Name`                                      | Påkrævet miljønavn.                                                                                   |
| `-Version`                                   | Identifikator for miljøversion; er som standard dets navn.                                            |
| `-Type`                                      | Miljøtype: `Custom`, `WindowsPowerShell`, `PowerShell7`, `Isolated` eller `Container`.                |
| `-Path`                                      | Sti til den eksekverbare fil for miljøet.                                                             |
| `-Arguments`                                 | Yderligere procesargumenter.                                                                          |
| `-Modules`                                   | Moduler, der er konfigureret til miljøet.                                                             |
| `-Variables`                                 | PSU-variabelnavne, der er tilgængelige for miljøet; standardværdien er `*`.                           |
| `-PSModulePath`                              | Yderligere PowerShell-modulstier.                                                                     |
| `-StartupScript`                             | Scripts, der skal udføres, når runspaces starter.                                                     |
| `-PersistentRunspace`                        | Aktiverer et vedvarende runspace.                                                                     |
| `-RunspaceRecycling`                         | Aktiverer genbrug af runspace.                                                                        |
| `-MaxRunspaces`                              | Maksimalt antal runspaces (standard 25).                                                              |
| `-MaxVirtualMemory`                          | Maksimal virtuel hukommelse i MB; konverteret til byte til lagring.                                   |
| `-RunspaceSaturationWarningThresholdPercent` | Advarselstærskelprocent for runspace-mætning (standard 80).                                           |
| `-RunspaceSaturationWarningDurationSeconds`  | Varighed af mætningsadvarsel i sekunder (standard 30).                                                |
| `-RecycleSchedule`                           | Tidsplan for genbrug af runspaces.                                                                    |
| `-Credential`                                | PSU-legitimationsoplysningsvariabel til udførelse, ikke en `PSCredential` til administrations-API'en. |
| `-Description`                               | Miljøbeskrivelse.                                                                                     |
| `-DisableImplicitWinCompat`                  | Deaktiverer implicit Windows-kompatibilitet.                                                          |
| `-Minimal`                                   | Aktiverer en minimal miljøopstart.                                                                    |
| `-Disabled`                                  | Opretter miljøet som deaktiveret.                                                                     |
| `-ProcessStartupScript`                      | Script, der køres ved processtart.                                                                    |
| `-EnableDebugger`                            | Ældre kompatibilitetsswitch; udsender nu kun en advarsel.                                             |
| `-Verb`                                      | Verbum, der bruges til at starte den eksekverbare fil.                                                |
| `-PowerShellVersion`                         | Installeret PowerShell-version eller multi-pwsh-vælger til isolerede miljøer.                         |
| `-Virtual`                                   | Aktiverer et administreret virtuelt miljø.                                                            |
| `-ContainerImageUrl`                         | Containerimage-URL.                                                                                   |
| `-ContainerImageTag`                         | Containerimage-tag.                                                                                   |
| `-ContainerPull`                             | Henter det konfigurerede containerimage.                                                              |
| `-ComputerName`                              | URL eller værtsnavn for PSU-målserveren (alias `-Uri`).                                               |
| `-AppToken`                                  | App-token til Management API.                                                                         |
| `-UseDefaultCredentials`                     | Bruger de aktuelle Windows-legitimationsoplysninger.                                                  |
| `-Integrated`                                | Bruger den integrerede administrationsklient i processen.                                             |
| `-TrustCertificate`                          | Ignorerer fejl ved certifikatvalidering.                                                              |
| `-Cookies`                                   | Genbruger sessionscookies til godkendelse.                                                            |

## Tilladelser

Adgangstokenet kræver `settings.environments/create` for at køre denne cmdlet eksternt.


---

# 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/da/powershell-kommandoer/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.
