< Back

Add-PodeSchedule

Sat Jan 18, 2020 7:13 pm

NAME Add-PodeSchedule



SYNOPSIS

Adds a new Schedule with logic to periodically invoke, defined using Cron Expressions.





SYNTAX

Add-PodeSchedule [-Name] <String> [-Cron] <String[]> [-ScriptBlock] <ScriptBlock> [[-Limit] <Int32>] [[-StartTime]

<DateTime>] [[-EndTime] <DateTime>] [[-ArgumentList] <Hashtable>] [-OnStart] [<CommonParameters>]





DESCRIPTION

Adds a new Schedule with logic to periodically invoke, defined using Cron Expressions.





PARAMETERS

-Name <String>

The Name of the Schedule.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Cron <String[]>

One, or an Array, of Cron Expressions to define when the Schedule should trigger.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ScriptBlock <ScriptBlock>

The script defining the Schedule's logic.



Required? true

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Limit <Int32>

The number of times the Schedule should trigger before being removed.



Required? false

Position? 4

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-StartTime <DateTime>

A DateTime for when the Schedule should start triggering.



Required? false

Position? 5

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EndTime <DateTime>

A DateTime for when the Schedule should stop triggering, and be removed.



Required? false

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ArgumentList <Hashtable>

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



Required? false

Position? 7

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OnStart [<SwitchParameter>]

If supplied, the schedule will trigger when the server starts, regardless if the cron-expression matches the

current time.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Add-PodeSchedule -Name 'RunEveryMinute' -Cron '@minutely' -ScriptBlock { /* logic */ }













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Add-PodeSchedule -Name 'RunEveryTuesday' -Cron '0 0 * * TUE' -ScriptBlock { /* logic */ }













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Add-PodeSchedule -Name 'StartAfter2days' -Cron '@hourly' -StartTime [DateTime]::Now.AddDays(2) -ScriptBlock

{ /* logic */ }













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Add-PodeSchedule -Name 'Args' -Cron '@minutely' -ScriptBlock { /* logic */ } -ArgumentList @{ Arg1 =

'value' }















RELATED LINKS