Enable-Disable Timer Jobs using PowerShell in SharePoint

Timer jobs perform specific tasks in SharePoint through Windows Timer service, such as sending email alerts at a scheduled time. In the SharePoint Central Administration site, you can check the timer jobs, disable or enable specific timer jobs.

PowerShell Script to Check Timer Job Status:

#Function to Check Timer job status
Function Get-TimerJobStatus($TimerJobName)
{
    $TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName } 
    if($TimerJob -eq $null)
    {
        Write-host "Timer job not found!" -ForegroundColor Red
        return
    }
    $TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
    if($TimerJobDisabled)
    {
        Write-host "Timer Job is Disabled!"  -ForegroundColor Yellow
    }
    else
    {
        Write-host "Timer Job is Enabled!"  -ForegroundColor Green
    }
    
}

$TimerJobName="My Site Cleanup Job"
Get-TimerJobStatus $TimerJobName

How to Disable a Timer job in SharePoint?

To disable a timer job, Head on to Central Administration >> Monitoring >> Timer Jobs >> Review job definitions >> pick your target from the list of timer jobs in SharePoint 2013 >> Click on the “Disable” button to disable a Timer job.

disable sharepoint timer job powershell

Disable SharePoint timer job using PowerShell

Here is the PowerShell to disable a timer job in SharePoint:

#Function to Disable a Timer job
Function Disable-TimerJob($TimerJobName)
{
    $TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName } 
    if($TimerJob -eq $null)
    {
        Write-host "Timer job not found!" -ForegroundColor Red
        return
    }
    $TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
    if($TimerJobDisabled)
    {
        Write-host "Timer Job is already Disabled!" -ForegroundColor Yellow
    }
    else
    {
        $TimerJob | Disable-SPTimerJob 
        Write-host "Timer Job Disabled!" -ForegroundColor Green
    }
    
}

#Timer job name to disable
$TimerJobName="My Site Cleanup Job"

#Call the function to Disable Timer job
Disable-TimerJob $TimerJobName

Activate timer job in SharePoint:

To activate a disabled timer job, Go to:

  • Central Administration >> Monitoring >> Timer Jobs 
  • Review job definitions >> pick your target from the list of timer jobs in SharePoint 2013 
  • Click on “Enable” button to activate the timer job.
enable timer job using powershell in sharepoint

This enables the disabled timer job in SharePoint 2013.

Enable SharePoint Timer job with PowerShell:

#Function to Enable a Timer job
Function Enable-TimerJob($TimerJobName)
{
    $TimerJob = Get-SPTimerJob | Where-Object { $_.displayname -like $TimerJobName } 
    if($TimerJob -eq $null)
    {
        Write-host "Timer job not found!" -ForegroundColor Red
        return
    }
    $TimerJobDisabled = $TimerJob | Select -ExpandProperty IsDisabled
    if($TimerJobDisabled)
    {
        $TimerJob | Enable-SPTimerJob 
        Write-host "Timer Job Enabled!" -ForegroundColor Green
    }
    else
    {
        Write-host "Timer Job is Already Enabled!" -ForegroundColor Yellow
    }    
}

#Timer job name to Enable
$TimerJobName="My Site Cleanup Job"

#Call the function to Enable Timer job
Enable-TimerJob $TimerJobName 

This activates timer job in SharePoint 2010 with PowerShell.

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *