I'm trying to automate as much of our SharePoint builds as possible, but there is currently one part I'm getting hung up on.

Right now, my event log is filled with error 6398 and error 5586, which according to my Google-fu is rectified by enabling HEALTH data collection (not just usage).

I've examined the object returned by Get-SPUsageApplication, and the one returned by Get-SPUsageService. I've also tried looking at every cmdlet I can think of and the closest I can find for configuring anything to do with Health Collection is the trio of Get/Disable/Enable-SPHealthAnalysisRule.

I'd really like to believe that MS really wouldn't forget to add in a way to enable this without having to go through CA, but so far I haven't found it.

If there's a way to do it with stsadm I suppose that'll work for now.

1 Answer 1


you can try this:

Write-Host "Enabling Heatlth Data Collection..."
$localFarm = [Microsoft.SharePoint.Administration.SPFarm]::Local

Enable Health Data Collection with PowerShell

  • I love you so much for this. Commented Nov 6, 2015 at 14:42
  • After some further poking and going from what you gave me, I discovered the Get-SPDiagnosticsProvider is the cmdlet I was looking for. A nice foreach loop and setting .IsDisabled (really Microsoft, why not Enabled?) to $false on each object has the same effect. Commented Nov 6, 2015 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.