Skip to content

Invoke Script

apobekiaris edited this page Jun 15, 2020 · 4 revisions

external help file: XpandPwsh-help.xml Module Name: XpandPwsh online version: schema: 2.0.0

Invoke-Script

SYNOPSIS

Invokes a Powershell script with retry options.

SYNTAX

Invoke-Script [-Script] <ScriptBlock> [[-Maximum] <Int32>] [-RetryInterval <Int32>]
 [-retryTriggerErrorPattern <String>] [<CommonParameters>]

DESCRIPTION

Invokes a Powershell script with retry options.

EXAMPLES

Example 1

PS C:\>  invoke-script {throw "test"} -Maximum 2
WARNING: test
Invoke-Script: Error: Retrying in 1 seconds, attempt1 out of 2
----------
Exception:
----------
test

Exception: test
-----------
StackTrace:
-----------
at <ScriptBlock>, <No file>: line 1
at Invoke-Script<Process>, C:\Work\eXpandFramework\XpandPwsh\XpandPwsh\public\System\Invoke-Script.ps1: line 22
at <ScriptBlock>, <No file>: line 1
Exception: test

Invokes the script two times.

PARAMETERS

-Maximum

{{ Fill Maximum Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

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

-RetryInterval

{{ Fill RetryInterval Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

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

-Script

{{ Fill Script Description }}

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

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

-retryTriggerErrorPattern

{{ Fill retryTriggerErrorPattern Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
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

None

OUTPUTS

System.Object

NOTES

RELATED LINKS

image

image


Star the project if you think it deserves it.

GitHub stars

Fork the project to extend and contribute.

GitHub forks

Clone this wiki locally