共用方式為


New-CMSchedule

建立Configuration Manager排程權杖。

語法

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

New-CMSchedule Cmdlet 會在 Configuration Manager 中建立排程權杖。 建立排程權杖來排程頻率不同的事件,例如每日、每週和每月。

若要將排程權杖解碼和編碼成間隔字串,請使用 Convert-CMSchedule Cmdlet。 然後,當您定義或修改物件時,可以使用間隔字串來設定排程屬性Configuration Manager。

注意事項

從Configuration Manager月臺磁片磁碟機執行 Configuration Manager Cmdlet,例如 PS XYZ:\> 。 如需詳細資訊,請 參閱開始使用

範例

範例 1:建立排程權杖

此命令會建立排程權杖,指定事件發生在指定日期和時間的當月最後一天, (2020 年 8 月 5 日星期三 17:46:03 太平洋日光節約時間) 。

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

範例 2:建立位移排程

下列範例會建立下列排程:

  • 從目前日期開始
  • 在當月的第二個星期一
  • 遞迴一次
$schedToken2 = New-CMSchedule -Start (Get-Date) -DayOfWeek Monday -WeekOrder Second -RecurCount 1 -OffsetDay 0

範例 3:建立排程以每日執行

此範例會建立每天永遠發生的簡單排程。 您可以在部署設定基準時使用這種排程類型。

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

參數

-Confirm

執行 Cmdlet 之前提示您確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

-DayOfMonth

指定當月發生事件的日期。 有效值的範圍從 0 到 31。 預設值為 0 ,表示當月的最後一天。

類型:Int32
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-DayOfWeek

指定一周中發生事件的日期。

類型:DayOfWeek
接受的值:Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-DisableWildcardHandling

此參數會將萬用字元視為常值字元值。 您無法將其與 ForceWildcardHandling結合。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DurationCount

指定發生排程事件的天數。 有效值的範圍從 0 到 31。 預設值為 0 ,表示排程的動作會無限期地繼續。

類型:Int32
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-DurationInterval

指定事件發生的時間。

類型:ScheduleInterval
接受的值:Minutes, Hours, Days
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-End

指定排程事件結束的日期和時間。

類型:DateTime
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ForceWildcardHandling

此參數會處理萬用字元,並可能導致非預期的行為 (不建議) 。 您無法將其與 DisableWildcardHandling結合。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-IsUtc

表示時間為國際標準時間 (UTC) 。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-LastDayOfMonth

表示事件會在當月的最後一天每月發生。

類型:SwitchParameter
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Nonrecurring

表示排程的事件不會重複發生。

類型:SwitchParameter
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-OffsetDay

使用此參數來設定位移,例如依工作日每月。 Parameter OffsetDays 的範圍為 7 天。

類型:Int32
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-RecurCount

指定排程事件的週期數目。

類型:Int32
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-RecurInterval

指定排程事件重複發生的時間。

類型:ScheduleInterval
接受的值:Minutes, Hours, Days
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ScheduleString

表示排程權杖已轉換成間隔字串。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Start

指定發生排程事件的日期和時間。

類型:DateTime
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-WeekOrder

指定當月發生事件的周。 預設值為 Last (0) 。

類型:ScheduleWeekOrder
接受的值:Last, First, Second, Third, Fourth
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-WhatIf

顯示執行 Cmdlet 時會發生什麼情況。 Cmdlet 不會執行。

類型:SwitchParameter
別名:wi
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

None

輸出

IResultObject

System.String