New-PSUEnvironment
SYNOPSIS
Creates a PowerShell Universal execution environment.
SYNTAX
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]. -Credential here is a PSU credential variable for execution, not a Management API credential.
DESCRIPTION
Creates an environment for APIs, scripts, apps, and security processes. -Type accepts Custom, WindowsPowerShell, PowerShell7, Isolated, or Container. For Isolated, -PowerShellVersion accepts an installed version or a multi-pwsh selector such as stable, preview, lts, or 7.4; -Virtual enables a managed multi-pwsh virtual environment. Container options configure the image URL, tag, and whether to pull it. -EnableDebugger is retained for compatibility but is no longer required and emits a warning.
EXAMPLE
New-PSUEnvironment -Name 'Isolated 7.4' -Type Isolated -PowerShellVersion '7.4' -VirtualPARAMETERS
-Name
Required environment name.
-Version
Environment version identifier; defaults to its name.
-Type
Environment type: Custom, WindowsPowerShell, PowerShell7, Isolated, or Container.
-Path
Executable path for the environment.
-Arguments
Additional process arguments.
-Modules
Modules configured for the environment.
-Variables
PSU variable names available to the environment; defaults to *.
-PSModulePath
Additional PowerShell module paths.
-StartupScript
Scripts to execute when runspaces start.
-PersistentRunspace
Enables a persistent runspace.
-RunspaceRecycling
Enables runspace recycling.
-MaxRunspaces
Maximum runspaces (default 25).
-MaxVirtualMemory
Maximum virtual memory in MB; converted to bytes for storage.
-RunspaceSaturationWarningThresholdPercent
Runspace saturation warning threshold percent (default 80).
-RunspaceSaturationWarningDurationSeconds
Saturation warning duration in seconds (default 30).
-RecycleSchedule
Schedule for recycling runspaces.
-Credential
PSU credential variable for execution, not a Management API PSCredential.
-Description
Environment description.
-DisableImplicitWinCompat
Disables implicit Windows compatibility.
-Minimal
Enables minimal environment startup.
-Disabled
Creates the environment disabled.
-ProcessStartupScript
Script run at process startup.
-EnableDebugger
Legacy compatibility switch; now only emits a warning.
-Verb
Verb used to launch the executable.
-PowerShellVersion
Installed PowerShell version or multi-pwsh selector for isolated environments.
-Virtual
Enables a managed virtual environment.
-ContainerImageUrl
Container image URL.
-ContainerImageTag
Container image tag.
-ContainerPull
Pulls the configured container image.
-ComputerName
Target PSU server URL or host name (alias -Uri).
-AppToken
Management API app token.
-UseDefaultCredentials
Uses current Windows credentials.
-Integrated
Uses the in-process management client.
-TrustCertificate
Ignores certificate validation errors.
-Cookies
Reuses session authentication cookies.
PERMISSIONS
The access token requires settings.environments/create to run this cmdlet remotely.
Last updated
Was this helpful?