We may have to run SharePoint timer jobs on-demand in some situations. Say for e.g. To update Rating values, I had to run the timer jobs: User Profile Service Application - Social Rating Synchronization Job and User Profile Service Application - Social Data Maintenance Job. Read more at SharePoint 2010 Rating Feature Configuration
How to run timer job manually in SharePoint 2010
So, To run a SharePoint 2010 timer Jobs on-demand, we used to navigate to Central Administration >> Monitoring >> Timer Jobs >> Review Job Definition >> Pick the timer jobs we want to run >> Click on "Run Now", BTW SharePoint 2007 doesn't offer way to run timer job manually!
This will run timer job immediately in SharePoint 2010.
SharePoint 2010 run timer job from PowerShell:
We can run timer job from code.
I've useddisplay name here, which various based on your installation. You can also use "Name" attribute, like:
Run SharePoint 2010 timer job programmatically with PowerShell:
In some other cases, you may have a timer job associated with multiple web applications and want to run a particular web app's timer job:
How to run timer job manually in SharePoint 2010
So, To run a SharePoint 2010 timer Jobs on-demand, we used to navigate to Central Administration >> Monitoring >> Timer Jobs >> Review Job Definition >> Pick the timer jobs we want to run >> Click on "Run Now", BTW SharePoint 2007 doesn't offer way to run timer job manually!
This will run timer job immediately in SharePoint 2010.
SharePoint 2010 run timer job from PowerShell:
We can run timer job from code.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Display name of the Timer Job to Run on-demand $TimerJobName = "User Profile SA - Social Rating Synchronization Job" #Get the Timer Job $TimerJob = Get-SPTimerJob | where { $_.DisplayName -match $TimerJobName} #start the timer job Start-SPTimerJob $TimerJob #Or use this One-liner:
#Get-SPTimerJob | where { $_.DisplayName -match "User Profile SA - Social Rating Synchronization Job"} | Start-SPTimerJob
I've useddisplay name here, which various based on your installation. You can also use "Name" attribute, like:
$TimerJob = Get-SPTimerJob | where { $_.Name -eq "User Profile Service_SocialRatingSyncJob" }
Run SharePoint 2010 timer job programmatically with PowerShell:
In some other cases, you may have a timer job associated with multiple web applications and want to run a particular web app's timer job:
#Display name of the Timer Job to Run on-demand $TimerJobName = "Workflow Auto Cleanup" #Get the Web Application $WebApp = Get-SPWebApplication "http://sharepoint.crescent.com" #Get the Timer Job associated with the given web application $TimerJob = Get-SPTimerJob | where { $_.DisplayName -match $TimerJobName} | where {$_.Parent -eq $WebApp } #start the timer job Start-SPTimerJob $TimerJob