You cannot start a timer job that is disabled. Use Enable-SPTimerJob
first to ensure that the timer job is enabled before attempting to start the job.
Set the Schedule for a Timer Job
Scenario/Problem: You need to set or modify the schedule of a specific timer job.
Solution: Use the Set-SPTimerJob
cmdlet.
Setting the schedule for a timer job can be facilitated by using the Set-SPTimerJob
cmdlet. Execute the Start-SPTimerJob
cmdlet with the Identity
of the timer job or a timer job variable along with the Schedule
parameter. Listing 3 shows a sample command line.
Listing 3. Setting the Schedule for a Timer Job
$timerJob = Get-SPTimerJob -Identity "DocIDEnable"
Set-SPTimerJob -Identity $timerJob -Schedule "Daily at 18:00:00"
The Schedule
parameter is a string value but must conform to one of the following schedule string formats:
• Every X minutes between 0 and 59.
• Hourly between 0 and 59.
• Daily at hh:mm:ss
.
• Weekly between <day> hh:mm:ss
and <day> hh:mm:ss
. (<day>
is the three-letter day of the week: Sun
, Mon
, Tue
, Wed
, Thu
, Fri
, or Sat
.)
• Monthly at dd hh:mm:ss
.
• Yearly at <month> dd hh:mm:ss
. (<month>
is the three-letter month: Jan
, Feb
, Mar
, and so on.)