Force Run SharePoint Health Analyzer Jobs on Demand using PowerShell
We may want to run SharePoint health analyzer on-demand to check if everything is alright on the farm, without waiting for them to run automatically. Well, as discussed in another article, Run SharePoint 2010 Timer Jobs On-Demand with PowerShell, we can force run SharePoint Health Analyzer timer Jobs on Demand with PowerShell!
How to run SharePoint 2013 health analyzer with PowerShell?
Let’s use PowerShell to force run health analyzer jobs. Here is the PowerShell to rerun health analyzer
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Display name of the Timer Job to Run on-demand
$TimerJobName = "Health Analysis Job"
#Get the Timer Job
$TimerJobs = Get-SPTimerJob | where { $_.DisplayName -match $TimerJobName}
foreach($TimerJob in $TimerJobs)
{
Write-Host "Running:" $TimerJob.DisplayName
$TimerJob.RunNow()
}
This script executes all timer jobs with “Health Analysis Job” in its display name which performs health check immediately!
One Liner to SharePoint 2013 run all health analyzer:
Get-SPTimerJob | where { $_.DisplayName -match "Health Analysis Job"} | % { Start-SPTimerJob $_ ; Write-Host "Runing Job:" $_.displayName }