Simply Migrate - Creating Simply Migrate Schedules

This article provides information on how to view, create, edit and remove Simply Migrate Schedules for Mimecast Partner Administrators.

Creating a New Schedule: 

New-SMSchedule

Use the following to create a new schedule event to be used in one or more jobs or batches.

NAME
 New-SMSchedule
SYNTAX
 New-SMSchedule [[-Type] {OneOff | Recurring}] [-Name ] [-
ScheduleWindowStart ]
 [-ScheduleWindowEnd ] [-StartTime ] [-EndTime ] [-Monday] [-Tuesday] [-
Wednesday]
 [-Thursday] [-Friday] [-Saturday] [-Sunday] [-JobId ] [-BatchId ] []
ALIASES
 None
REMARKS
 None

 

Example 1: One-off Schedule

The most simple kind of schedule only has one start date and time, and it appears as follows:

PS C:\> New-SMSchedule -Name "EndOfMonth" -Type OneOff -ScheduleWindowStart
"31/08/2017 18:00"
EntryId : 30
Type : OneOff
Name : EndOfMonth
ScheduleWindowStart : 31/08/2017 18:00:00
ScheduleWindowEnd :
StartTime :
EndTime :
Monday :
Tuesday :
Wednesday :
Thursday :
Friday :
Saturday :
Sunday :
Links : {}

In this example a OneOff schedule has been created with a ScheduleWindowStart date and time to identify when this schedule will start, you could also supply a ScheduleWindowEnd date and time to specify when this must end.


Example 2: Weekend schedule

Another commonly used schedule is one that will only run on weekends, this can be created as shown below:

PS C:\> New-SMSchedule -Name "Weekends" -Type Recurring -Saturday -Sunday
EntryId : 31
Type : Recurring
Name : Weekends
ScheduleWindowStart :
ScheduleWindowEnd :
StartTime :
EndTime :
Monday : False
Tuesday : False
Wednesday : False
Thursday : False
Friday : False
Saturday : True
Sunday : True
Links : {}

This is an example of a recurring schedule event that will be active every Saturday and Sunday for all time. Here, we have not specified dates or times for the for: Start/EndTime or ScheduleWindowStart/End. However, setting dates and times would create a specific period on weekends that the schedule will be active.

 

Example 3: Weeknights after Business Hours

To prevent a job or batch of jobs from running during business hours, a recurring time-based schedule can be created as shown below:

PS C:\> New-SMSchedule -Name "Weekday evenings" -Type Recurring -StartTime
19:00 -EndTime 06:00 -Monday -Tuesday -Wednesday -Thursday -Friday

EntryId : 32
Type : Recurring
Name : Weekday evenings
ScheduleWindowStart :
ScheduleWindowEnd :
StartTime : 19:00:00
EndTime : 06:00:00
Monday : True
Tuesday : True
Wednesday : True
Thursday : True
Friday : True
Saturday : False
Sunday : False
Links : {}

In this example, a recurring schedule has been created for Monday through Friday between 19:00 and 06:00.

Note that Jobs and Batches can be linked to multiple schedules. For example, if for a particular month you would like to increase the schedule window, you could create a copy of the above with the increased time periods, e.g. between 17:00 and 09:00, but include the ScheduleWindowStart and ScheduleWindowEnd dates to indicate that during that special period those longer hours are available.  
 

To view, update or remove existing schedules there are the following options.
 

Viewing existing Schedules:

  • Get-SMSchedules

This can be used to view an existing schedule(s). 

NAME
 Get-SMSchedules
SYNTAX
 Get-SMSchedules [[-ScheduleId] ] [-Type {OneOff | Recurring}] [-JobId ]
[-BatchId ]
 []
ALIASES
 None
REMARKS
 None

Get-SMSchedules example:

PS C:\> Get-SMSchedules 32
EntryId : 32
Type : Recurring
Name : Weekday evenings
ScheduleWindowStart :
ScheduleWindowEnd :
StartTime : 19:00:00
EndTime : 06:00:00
Monday : True
Tuesday : True
Wednesday : True
Thursday : True
Friday : True
Saturday : False
Sunday : False
Links : {}

Updating a Schedule: 

  • Set-SMSchedule

This can be used to update an existing schedule.

Example 1 – Updating a schedule:

Below, we have changed the working days in this schedule from Mon-Fri to Mon-Thurs.

PS C:\> Set-SMSchedule 32 -Monday -Tuesday -Wednesday -Thursday
EntryId : 32
Type : Recurring
Name : Weekday evenings
ScheduleWindowStart :
ScheduleWindowEnd :
StartTime : 19:00:00
EndTime : 06:00:00
Monday : True
Tuesday : True
Wednesday : True
Thursday : True
Friday : False
Saturday : False
Sunday : False
Links : {}
 

Example 2 – Adding a schedule to a Job:

PS C:\> Set-SMSchedule 32 -Monday -Tuesday -Wednesday -Thursday -JobId 5
EntryId : 32
Type : Recurring
Name :
ScheduleWindowStart :
ScheduleWindowEnd :
StartTime : 19:00:00
EndTime : 06:00:00
Monday : True
Tuesday : True
Wednesday : True
Thursday : True
Friday : False
Saturday : False
Sunday : False
Links : {32}

JobId or BatchId can be used in Set-SMSchedule, but you can also use the normal New-SMJob / Set-SMJob and New-SMBatch / Set-SMBatch cmdlets as shown below to apply a schedule.

Using schedules in Jobs and Batches

To add a schedule to an existing job using Set-SMJob, use the following new option:

PS C:\> Set-SMJob 10 -Schedules 31,33
JobId : 10
BatchId : 1
JobStatus : Processing
StatusMessage :
Priority : 10
PercentComplete : 90
TimeStarted : 16/11/2016 10:38:47
TimeFinished : 16/11/2016 10:38:48
SourceMailbox : C:\Temp\TestUser
TargetMailbox : FilesMsg
Source : FilesEml
Target : FilesMsg
DateFrom : 01/01/1900 00:00:00
DateTo : 02/01/2100 00:00:00
ItemsTotal : 202
ItemsFailed : 0
ItemsRemaining : 21
FailedCount : 0
JobCreatedBy : nsp
JobModifiedBy : nsp
JobCreated : 16/11/2016 10:38:47
JobModified : 24/08/2017 14:29:52
[...]
Entries :
Schedules : {Weekends, Weekday evenings}

As shown above in the new job property Schedules we can assign one or more schedules to a given job. The same can be done for a batch:

PS C:\> Set-SMBatch 1 -Schedules 31,33
BatchId : 1
BatchName : Main
CreatedDate : 16/11/2016 21:05:30
Jobs : {105}
IsActive : False
InProgress :
Schedules : {Weekends, Weekday evenings}

Removing a Schedule:

Remove-SMSchedules

Finally, in order to delete previously created schedules use the following:

 Remove-SMSchedules
SYNTAX
 Remove-SMSchedules [[-ScheduleId] ] [-Schedules <Schedule[]>] [-JobId ]
[-BatchId ] [-Force]
 []
ALIASES
 None
REMARKS
 None

Remove-SMSchedule example:

PS C:\> Remove-SMSchedules 5
Confirm
Are you sure you want to DELETE this schedule 5?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
WARNING: Schedule 5 deleted.

This will completely delete the schedule(s), and remove any existing links to jobs or batches. With the flexibility of creating schedules and assigning them to one or more jobs or batches, i.e. a many to many relationship, it is possible to meet almost any complex scheduling requirement.

See Also..

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.