Set-PSUSchedule
SYNOPSIS
Updates a schedule.
SYNTAX
Set-PSUSchedule -Schedule <Schedule> [<ScheduleOptions>] [<ConnectionOptions>] [<CommonParameters>]
Set-PSUSchedule -Id <Int64> [<ScheduleOptions>] [<ConnectionOptions>] [<CommonParameters>]<ScheduleOptions>: [-Cron <String>] [-Description <String>] [-Script <String[]>] [-Workflow <String>] [-TimeZone <String>] [-Continuous <Boolean>] [-Delay <TimeSpan>] [-Credential <String>] [-OneTime <DateTime>] [-Environment <String>] [-Parameters <List[ScheduleParameter]>] [-Name <String>] [-Paused <Boolean>] [-Timeout <Int32>] [-Condition <String>] [-RandomDelay <Boolean>] [-Computer <String>] [-RandomDelayMaximum <Int32>] [-AvailableInBranch <List[String]>] [-Module <String>] [-EveryHour <Boolean>] [-Minute <Int32>] [-EveryDay <Boolean>] [-Hour <Int32>] [-DayOfWeek <Boolean>] [-Day <String[]>] [-EveryMonth <Boolean>] [-DayOfMonth <Int32>] [-SpecificMonth <Boolean>] [-Month <String[]>] [-ComputerGroup <String>] [-ComputerGroupInvocationType <ComputerGroupInvocationType>] [-Folder <String>].
<ConnectionOptions>: [-ComputerName <String>] [-AppToken <String>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]. -Credential here names the scheduled run's credential, not Management API authentication.
DESCRIPTION
Updates only the supplied fields on a schedule selected by ID or pipeline object. -Script accepts one or more script paths (alias -Scripts), and -Workflow selects a workflow by name. -Parameters accepts a list of ScheduleParameter objects, not a hashtable. -OneTime is stored in UTC using the supplied -TimeZone or the schedule's existing time zone; an explicit $null clears it.
EXAMPLES
Set-PSUSchedule -Id 12 -Name 'Nightly Cleanup' -Cron '0 0 * * *'
Set-PSUSchedule -Id 12 -Workflow 'Deploy' -OneTime (Get-Date).AddHours(1)PARAMETERS
-Schedule
Schedule object to update; accepts pipeline input.
-Id
Numeric schedule ID; accepts pipeline input.
-Cron
New cron expression.
-Description
New schedule description.
-Script
One or more script paths; alias -Scripts.
-Workflow
Workflow name.
-TimeZone
IANA time zone used for schedule times.
-Continuous
Enables or disables continuous runs.
-Delay
Delay between continuous runs.
-Credential
Name of the scheduled run's PSU credential.
-OneTime
One-time date; $null clears it.
-Environment
Execution environment.
-Parameters
List of ScheduleParameter values for the target.
-Name
Schedule name.
-Paused
Enables or disables the paused state.
-Timeout
Scheduled run timeout.
-Condition
Condition expression used before execution.
-RandomDelay
Enables or disables random delay.
-RandomDelayMaximum
Maximum random delay.
-Computer
Execution computer, not Management API URL.
-AvailableInBranch
Git branches in which the schedule is available.
-Module
Target PowerShell module name.
-EveryHour
Enables or disables hourly scheduling.
-Minute
Minute component for calendar schedules.
-EveryDay
Enables or disables daily scheduling.
-Hour
Hour component for calendar schedules.
-DayOfWeek
Enables or disables weekday scheduling.
-Day
Weekdays selected when -DayOfWeek is enabled.
-EveryMonth
Enables or disables monthly scheduling.
-DayOfMonth
Day of month for monthly scheduling.
-SpecificMonth
Enables or disables specific-month scheduling.
-Month
Selected months.
-ComputerGroup
Computer group selected for runs.
-ComputerGroupInvocationType
How jobs are invoked across the computer group.
-Folder
Schedule folder.
-ComputerName
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.
INPUTS
PowerShellUniversal.Schedule or schedule ID.
PERMISSIONS
The access token requires automation.schedules/update to run this cmdlet remotely.
Last updated
Was this helpful?