We may want to run SharePoint health analyzer on-demand to check if everything is alright in the farm, without waiting for them to run automatically. Well, as discussed in my 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 2010/2013 health analyzer with PowerShell:
Lets use PowerShell to force run health analyzer jobs.
One Liner to SharePoint 2010/2013 run all health analyzer:
How to run SharePoint 2010/2013 health analyzer with PowerShell:
Lets use PowerShell to force run health analyzer jobs.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinueThis script executes all timer jobs with "Health Analysis Job" in its display name which performs health check immediately!
#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()
}
One Liner to SharePoint 2010/2013 run all health analyzer:
Get-SPTimerJob | where { $_.DisplayName -match "Health Analysis Job"} | % { Start-SPTimerJob $_ ; Write-Host "Runing Job:" $_.displayName } #