Skip to content

Add-PodeTask

SYNOPSIS

Adds a new Task.

SYNTAX

Script (Default)

Add-PodeTask -Name <String> -ScriptBlock <ScriptBlock> [-ArgumentList <Hashtable>] [<CommonParameters>]

File

Add-PodeTask -Name <String> -FilePath <String> [-ArgumentList <Hashtable>] [<CommonParameters>]

DESCRIPTION

Adds a new Task, which can be asynchronously or synchronously invoked.

EXAMPLES

EXAMPLE 1

Add-PodeTask -Name 'Example1' -ScriptBlock { Invoke-SomeLogic }

EXAMPLE 2

Add-PodeTask -Name 'Example1' -ScriptBlock { return Get-SomeObject }

PARAMETERS

-ArgumentList

A hashtable of arguments to supply to the Task's ScriptBlock.

Type: Hashtable
Parameter Sets: (All)
Aliases:

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

-FilePath

A literal, or relative, path to a file containing a ScriptBlock for the Task's logic.

Type: String
Parameter Sets: File
Aliases:

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

-Name

The Name of the Task.

Type: String
Parameter Sets: (All)
Aliases:

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

-ScriptBlock

The script for the Task.

Type: ScriptBlock
Parameter Sets: Script
Aliases:

Required: True
Position: Named
Default value: None
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

NOTES

Back to top