Following an installation, nothing gives me more joy (pertaining to SharePoint anyway) than having a clean Health Report days after my installation (AKA: Review Problems and Solutions). Recently though, I was doing an installation and I decided to try to “force run” the health rules rather than wait for them to run.
I wrote this in PowerShell to run all the jobs on demand:
$jobs = Get-SPTimerJob | Where-Object {$_.Title -like "Health Analysis Job*"}
foreach ($job in $jobs)
{
$job.RunNow()
}
After the run, return to Monitoring | Review Problems and solutions and see how you did.



Matt used a foreach loop to separate out the retrieval from the execution but if you want to keep this more streamlined you can simply pipe the jobs to the Start-SPTimerJob cmdlet:
Get-SPTimerJob | where {$_.Title -like “Health Analysis Job*”} | Start-SPTimerJob
This eliminates the need for the loop and keeps it one nice and tidy line.
Thanks Gary! I like the one line approach! I tend to fall back on foreach too often.
Is there really any performance penalty of the two approaches? In the spirit of readability, I much prefer the multilined foreach approach for scripts.