Creating Schedules with New-CMSchedule

If you ever did any schedule creation prior to the two new PowerShell cmdlets (New-CMSchedule and Convert-CMSchedule), then you probably already know how tricky it was working with scheduled tokens and are going to welcome these new cmdlets.  In this blog post, I am going to show you how easy it is to use New-CMSchedule to create a weekly recurring schedule.

Schedules are used for many things in ConfigMgr, such as collection evaluation cycles, deployment times and even certain client settings.  For this example, we will create a collection evaluation schedule.  The first thing we need to do is determine what kind of schedule we want to create.  Let’s select a weekly recurring schedule that runs every Saturday at 9:00 PM.  For simplicity, we will start this on 10/12/2013.  Using the console, the schedule would look like this:

Custom Schedule

From this, we can extract the following information:
Start time: 10/12/2013 9:00 PM
Day of the week: Saturday
Recur every: 1 week

We can easily create this schedule using the following command:

New-CMSchedule -Start "10/12/2013 9:00 PM" -DayOfWeek Saturday -RecurCount 1

Assign this schedule to the variable $Schedule so that we can use it to create a new collection:

$Schedule = New-CMSchedule -Start "10/12/2013 9:00 PM" -DayOfWeek Saturday -RecurCount 1

Create a new collection called TEST-Collection Schedule using the following command:

New-CMDeviceCollection -Name "TEST-Collection Schedule" -LimitingCollectionName "All Systems" -RefreshSchedule $Schedule -RefreshType Periodic

NOTE: There are actually four different refresh types that can be set, however, the current cmdlet only supports three of them. If you want to configure incremental updates and full collection evaluation based on a schedule, you will need to set this directly

If you open the collection properties up using the console, you will notice that you now have a collection called TEST-Collection Schedule and it has a custom refresh schedule like the one pictured above.

This is just one example on how easy it is to create schedules in ConfigMgr using the New-CMSchedule cmdlet.

2 thoughts on “Creating Schedules with New-CMSchedule

  1. Hi,

    If i use the New-cmschedule with days of week and create a AD system discovery , it fails:

    $sched= New-CMSchedule -Start “02/11/2015 04:00 AM” -DayOfWeek Sunday -RecurCount 1

    Set-CMDiscoveryMethod -ActiveDirectorySystemDiscovery -SiteCode $Site.SiteCode -Enabled $True -PollingSchedule $sched

    Is this not supported?

    Regards,
    Vinod

Leave a Reply to materrill Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.