New-PSUMiddleware
SYNOPSIS
Creates a new HTTP middleware.
SYNTAX
New-PSUMiddleware -Name <String> -ScriptBlock <ScriptBlock> [-Order <Int32>] [-ComputerName <String>]
[-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate]
[-Cookies] [<CommonParameters>]DESCRIPTION
Creates a new HTTP middleware. This is executed with each request.
EXAMPLES
Example 1
PS C:\> New-PSUMiddleware -Name 'Middle' -ScriptBlock {
param($HttpContext)
$HttpContext.Response.Cookies.Append('X-Test', "Test")
$true
}Creates a new middleware named 'Middle' that adds a cookie to the response.
PARAMETERS
-AppToken
The AppToken that is used for calling the PowerShell Universal Management API. You can also call Connect-PSUServer before calling this cmdlet to set the AppToken for the entire session.
-ComputerName
Specifies the computer name or URL that should be called when accessing the PowerShell Universal Management API. You can also use Connect-PSUServer before calling this cmdlet to set the computer name for the entire session.
-Integrated
Executes the command internally rather than using the Management API. Only works when running script from within PowerShell Universal.
-Name
The name of the middleware.
-Order
The order of the middleware. Lower numbers are executed first.
-ScriptBlock
The script block to execute the middleware.
-UseDefaultCredentials
Use the default credentials when accessing the PowerShell Universal Management API.
-Credential
Credentials to login to the PowerShell Universal Management API.
-TrustCertificate
Whether the cmdlet should ignore certificate issues.
-Cookies
Reuses and persists authentication cookies for the current PowerShell session.
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable, and -ProgressAction. For more information, see about_CommonParameters.
INPUTS
None
OUTPUTS
System.Object
NOTES
RELATED LINKS
Last updated
Was this helpful?