For the complete documentation index, see llms.txt. This page is also available as Markdown.

New-PSUSchedule

SYNOPSIS

Creates a schedule for scripts or workflows.

SYNTAX

Select either -Script <Script[]> (alias -Scripts; accepts pipeline input) or -Workflow <Workflow>, and one timing form:

New-PSUSchedule -Script <Script[]> -Cron <String> [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -Cron <String> [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -Continuous [-Delay <TimeSpan>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -Continuous [-Delay <TimeSpan>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> [-OneTime <DateTime>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> [-OneTime <DateTime>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -EveryHour [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -EveryHour [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -EveryDay [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -EveryDay [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -DayOfWeek -Day <String[]> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -DayOfWeek -Day <String[]> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -EveryMonth -DayOfMonth <Int32> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -EveryMonth -DayOfMonth <Int32> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Script <Script[]> -SpecificMonth -Month <String[]> -DayOfMonth <Int32> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]
New-PSUSchedule -Workflow <Workflow> -SpecificMonth -Month <String[]> -DayOfMonth <Int32> [-Hour <Int32>] [-Minute <Int32>] [<ScheduleOptions>] [<ConnectionOptions>]

<ScheduleOptions>: [-Name <String>] [-Description <String>] [-Credential <Variable>] [-TimeZone <String>] [-Environment <String>] [-Paused] [-RandomDelay] [-RandomDelayMaximum <Int32>] [-Timeout <Int32>] [-Condition <ScriptBlock>] [-Computer <String>] [-Parameters <Hashtable>] [-AvailableInBranch <String[]>] [-Folder <String>]. Continuous schedules also accept [-DelaySecond <Int32>] [-DelayMinute <Int32>] [-DelayHour <Int32>] as alternatives to -Delay. <ConnectionOptions>: [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies].

DESCRIPTION

Schedules one or more scripts or a workflow. Choose a timing mode: cron expression, continuous with optional delay, one-time date, hourly, daily, weekly, monthly, or specific months. -Parameters supplies values to the target, including one-time scripts with no declared param block. With one script, declared script parameters may also be supplied dynamically; use -Parameters if dynamic lookup fails. Here -Credential is a PSU credential variable for the scheduled run, not a Management API credential.

EXAMPLES

PARAMETERS

Parameter
Description

-Script

Script target(s), alias -Scripts; accepts pipeline input.

-Workflow

Workflow target (instead of scripts).

-Cron

Cron expression for the cron timing form.

-Continuous

Runs repeatedly; optionally set an inter-run delay.

-Delay

Inter-run TimeSpan for continuous schedules.

-DelaySecond, -DelayMinute, -DelayHour

Alternative continuous delays in seconds, minutes, or hours (each sets the same delay).

-OneTime

Date and time to run once.

-EveryHour

Runs hourly; -Minute chooses the minute.

-EveryDay

Runs daily; -Hour and -Minute choose the time.

-DayOfWeek, -Day

Runs on specified weekdays; -Day is required with this timing mode.

-EveryMonth, -DayOfMonth

Runs monthly on a required day of month.

-SpecificMonth, -Month

Runs only in specified months; -Month and -DayOfMonth are required.

-Hour, -Minute

Hour and minute for calendar timing modes.

-Name

Reusable schedule name.

-Description

Schedule description.

-Credential

PSU credential variable for execution.

-TimeZone

Schedule time zone (defaults to the system time zone).

-Environment

Execution environment for the target.

-Paused

Creates a paused schedule.

-RandomDelay

Adds a random delay.

-RandomDelayMaximum

Maximum random delay (defaults to 60).

-Timeout

Scheduled run timeout.

-Condition

Script block condition for execution.

-Computer

Execution computer or group, not the management server URL.

-Parameters

Hashtable of target parameter values.

-AvailableInBranch

Branches in which the schedule is available.

-Folder

Schedule folder.

-ComputerName

Target PSU Management API URL or host name (alias -Uri).

-AppToken

Management API app token.

-UseDefaultCredentials

Uses current Windows credentials.

-Integrated

Uses the in-process management client.

-TrustCertificate

Ignores certificate validation errors.

-Cookies

Reuses session authentication cookies.

PERMISSIONS

The access token requires automation.schedules/create to run this cmdlet remotely.

Last updated

Was this helpful?