Joel recently posted: Warning to SharePoint Administrators: Don’t Ignore the Red Health Bar and you should follow his advice and maintain your farm. While preparing a roll-out for a client I created yet another SharePoint 2010 lab/test farm. Once finished I wanted to check if everything is okey with the farm, but could not wait for hour/day/week month till health jobs executed via SharePoint timer. 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.