New-CMSchedule

Create a Configuration Manager schedule token.

Syntax

New-CMSchedule
   [-IsUtc]
   [-Nonrecurring]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfMonth <Int32>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfMonth <Int32>
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfMonth <Int32>
   -End <DateTime>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   -End <DateTime>
   [-IsUtc]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   [-IsUtc]
   [-OffsetDay <Int32>]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   -WeekOrder <ScheduleWeekOrder>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   [-OffsetDay <Int32>]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   -WeekOrder <ScheduleWeekOrder>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DayOfWeek <DayOfWeek>
   -End <DateTime>
   [-IsUtc]
   [-OffsetDay <Int32>]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   -WeekOrder <ScheduleWeekOrder>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   [-Nonrecurring]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   [-LastDayOfMonth]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -DurationCount <Int32>
   -DurationInterval <ScheduleInterval>
   [-IsUtc]
   -RecurCount <Int32>
   -RecurInterval <ScheduleInterval>
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -End <DateTime>
   [-IsUtc]
   [-Nonrecurring]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -End <DateTime>
   [-IsUtc]
   [-LastDayOfMonth]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   -End <DateTime>
   [-IsUtc]
   -RecurCount <Int32>
   -RecurInterval <ScheduleInterval>
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   [-IsUtc]
   [-LastDayOfMonth]
   [-RecurCount <Int32>]
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMSchedule
   [-IsUtc]
   -RecurCount <Int32>
   -RecurInterval <ScheduleInterval>
   [-ScheduleString]
   [-Start <DateTime>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-CMSchedule cmdlet creates a schedule token in Configuration Manager. Create schedule tokens to schedule events with differing frequencies such as daily, weekly, and monthly.

To decode and encode schedule tokens into and from an interval string, use the Convert-CMSchedule cmdlet. You can then use the interval strings to set schedule properties when you define or modify Configuration Manager objects.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Create a schedule token

This command creates a schedule token that specifies that the event occurs on the last day of the month at the specified date and time (Wednesday, August 5, 2020 17:46:03 Pacific Daylight Time).

$schedToken1 = New-CMSchedule -DayOfMonth 0 -Start "2020-08-05T17:46:03.7236084-07:00"

Example 2: Create an offset schedule

The following example creates the following schedule:

  • Starts on the current date
  • On the second Monday of the month
  • Recurs once
$schedToken2 = New-CMSchedule -Start (Get-Date) -DayOfWeek Monday -WeekOrder Second -RecurCount 1 -OffsetDay 0

Example 3: Create a schedule to run daily

This example creates a simple schedule that occurs daily forever. You can use this type of schedule when you deploy a configuration baseline.

New-CMSchedule -DurationInterval Days -DurationCount 0 -RecurInterval Days -RecurCount 1

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DayOfMonth

Specifies the day of the month when the event occurs. Valid values range from 0 through 31. The default value is 0, which indicates the last day of the month.

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

-DayOfWeek

Specifies the day of the week when the event occurs.

Type:DayOfWeek
Accepted values:Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

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

-DurationCount

Specifies the number of days during which the scheduled event occurs. Valid values range from 0 through 31. The default value is 0, which indicates that the scheduled action continues indefinitely.

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

-DurationInterval

Specifies the time when the event occurs.

Type:ScheduleInterval
Accepted values:Minutes, Hours, Days
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-End

Specifies the date and time when the scheduled event ends.

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

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

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

-IsUtc

Indicates that the time is Coordinated Universal Time (UTC).

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

-LastDayOfMonth

Indicates that the event occurs monthly on the last day of the month.

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

-Nonrecurring

Indicates that the scheduled event doesn't recur.

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

-OffsetDay

Use this parameter to configure an offset such as monthly by weekday. The range for parameter OffsetDays is 7 days.

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

-RecurCount

Specifies the number of recurrences of the scheduled event.

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

-RecurInterval

Specifies the time when the scheduled event recurs.

Type:ScheduleInterval
Accepted values:Minutes, Hours, Days
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ScheduleString

Indicates that the schedule token is converted to an interval string.

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

-Start

Specifies the date and time when the scheduled event occurs.

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

-WeekOrder

Specifies the week of the month when the event occurs. The default value is Last (0).

Type:ScheduleWeekOrder
Accepted values:Last, First, Second, Third, Fourth
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

IResultObject

System.String