Run all SharePoint 2010 Health Rules At Once

Here is a simple PowerShell script to execute all farm health check immediately:

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
  Write-Host "Loading SharePoint Powershell Snapin"
  Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

Get-SPTimerJob | Where {$_.Name -like "*Health*" -and $_.Name -like "*-all-*"} | Start-SPTimerJob

Couple of notes:

  • The script will start all SPTimerJobs that contain words Health and -all- in job name
  • A “health job” with the keyword “-all-” in its name will run on all servers in the farm that run the SharePoint Timer Service and the Usage and Health Data Collection Service application
  • A “health job” with the keyword “-any-” in its name will run on the first server found in the farm that runs the SharePoint Timer Service and the Usage and Health Data Collection Service application.
  • Check full list of SPTimerJob definitions.

Categories: SharePoint 2010
Permalink | Comments (0) | Post RSSRSS comment feed