Add-KrTasksService

SYNOPSIS

Adds ad-hoc Tasks support to the Kestrun server.

SYNTAX

Add-KrTasksService [[-Server] <KestrunHost>] [[-MaxRunspaces] <Int32>] [-PassThru] [<CommonParameters>]

DESCRIPTION

Registers the Kestrun Task service on the server, enabling one-off script execution (PowerShell, C#, VB.NET) with status/result and cancellation support.

EXAMPLES

EXAMPLE 1

Add-KrTasksService
Adds the Tasks service to the default server.

EXAMPLE 2

$server = Add-KrTasksService -PassThru
Adds the Tasks service and returns the server instance.

PARAMETERS

-Server

The Kestrun server instance.

Type: KestrunHost
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-MaxRunspaces

Optional maximum PowerShell runspaces for task execution; falls back to scheduler sizing when omitted.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns the server when specified.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

Kestrun.Hosting.KestrunHost

NOTES

Requires the Kestrun.Hosting.KestrunHost.AddTasks() method. If the Tasks service is already registered, this cmdlet has no effect. The Tasks service enables ad-hoc script execution via New-KrTask, Start-KrTask, Stop-KrTask, Remove-KrTask. The Tasks service uses PowerShell runspaces for PowerShell tasks; the MaxRunspaces parameter controls the maximum number of concurrent runspaces.