Display Available Timer Jobs on the Farm
Scenario/Problem: You need to obtain a timer jobs reference and therefore need a listing of available timer jobs.
Solution: Use the Get-SPTimerJob
cmdlet without any parameters to retrieve all available timer jobs.
To obtain a timer job reference object, you need to find the identity of the timer job. Using Get-SPTimerJob
by itself (see Listing 1) displays all available timer jobs, as shown in Figure 1.
Listing 1. Displaying All Available Timer Jobs
Get-SPTimerJob
Figure 1. Get-SPTimerJob displays all available timer jobs.
Get a Specific Timer Job
Scenario/Problem: You need to obtain a specific timer job reference.
Solution: Use the Get-SPTimerJob
cmdlet to assign a variable the results using the -Identity
parameter.
Providing the identity of the timer job with the Get-SPTimerJob
cmdlet retrieves a specific timer job. Use this to assign the results to an object for use in other cmdlets, as shown in Listing 2.
Listing 2. Assigning a Variable to a Specific Timer Job
$timerJob = Get-SPTimerJob -Identity "DocIDEnable"
In this case, the Identity
parameter is the name shown when retrieving all timer jobs (Get-SPTimerJob
). You also can use the GUID of the timer job.
Enable a Timer Job
Scenario/Problem: You want to enable a specific timer job.
Solution: Use the Enable-SPTimerJob
cmdlet.
To enable a timer job, execute the Enable-SPTimerJob
cmdlet with the Identity
of the timer job or a timer job variable. Listing 3 shows a sample command line.
Listing 3. Enabling a Timer Job
$timerJob = Get-SPTimerJob -Identity "DocIDEnable"
Enable-SPTimerJob $timerJob