Skip to content

Invoke-PodeScriptBlock

SYNOPSIS

Invokes a ScriptBlock.

SYNTAX

Invoke-PodeScriptBlock [-ScriptBlock] <ScriptBlock> [[-Arguments] <Object>] [-Scoped] [-Return] [-Splat]
 [-NoNewClosure] [<CommonParameters>]

DESCRIPTION

Invokes a ScriptBlock, supplying optional arguments, splatting, and returning any optional values.

EXAMPLES

EXAMPLE 1

Invoke-PodeScriptBlock -ScriptBlock { Write-Host 'Hello!' }

EXAMPLE 2

Invoke-PodeScriptBlock -Arguments 'Morty' -ScriptBlock { /* logic */ }

PARAMETERS

-Arguments

Any arguments that should be supplied to the ScriptBlock.

Type: Object
Parameter Sets: (All)
Aliases:

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

-NoNewClosure

Don't create a new closure before invoking the ScriptBlock.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Return

Return any values that the ScriptBlock may return.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Scoped

Run the ScriptBlock in a scoped context.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ScriptBlock

The ScriptBlock to invoke.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

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

-Splat

Spat the argument onto the ScriptBlock.

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

System.Object

NOTES