Endpoint Initialization
Required Version: 2.0 or later
Endpoints within Universal Dashboard are run using a shared runspace pool. Runspaces are created and retained to ensure that performance is as best as it can be. As requests come in, more runspaces will be created up to a certain limit and then runspaces will be reused. When the runspaces are created, they are initialized with the return value of the New-UDEndpointInitialization
cmdlet. This value is passed to the New-UDDashboard
cmdlet via the -EndpointInitialization
cmdlet.
Passing Variables to Endpoints
Much like global:
scope variables, variables that you pass to endpoints are available in all endpoints. To pass a variable, simply provide the name of the variable to the initialization cmdlet.
You'll now be able to use $MyVariable
in all your endpoints.
You can also pass arrays of variable names.
Passing Functions to Endpoints
Functions are passed just like variables but using the -Function
parameter.
They also support arrays.
Loading Modules in Endpoints
The name or path of the module should be provided to the -Module
parameter. You can specify arrays of modules or paths. Relative paths are relative to the current file.
Other Endpoint Initialization Properties
The New-UDEndpointInitiailization
cmdlet returns a InitialSessionState object. This object is part of the PowerShell SDK and provides more customization than does the cmdlet. You can store the result in a variable and set additional properties.
Last updated