SharePoint 2016, Sharepoint 2013, Sharepoint 2010, Windows Server 2012, Sql Server 2012,2014,IIS, Active Directory,User Profile Service, Managed MetaData Service, Search Service, Topology, Web Application, IIS, Site collection, List, Library, PowerShell, office web app, Windows Authentication, NTLM, Kerberos, Saml, ADFS, Active Directory Import, MIM, SharePoint 2016 Managing Health Analysis Rules ( Real World Example) – SharePoint

SharePoint 2016 Managing Health Analysis Rules ( Real World Example)

This article is a sequence of real world examples of the using PowerShell in SharePoint 2016. In this article, we will discuss how we will use the PowerShell cmdlets to managing the Health Analysis rule in SharePoint. We will try to cover all the available cmdlets i.e. get, enable and, disable.

Scenario:

KrossFarm administrator having some known issues with their environments but certain Health Analysis Rule annoying them. So they want to disable all rules in the Lower environment( dev farms) and Disable Certain Rules in the Production Farm. Also, they found one of the Health Rule( TimerRecycleFailed) is already Disabled in the Production farm which they want enable it.

Tasks:

  • Get the Health Analysis Rule
  • Disable All Rules in Dev and Few in Production
  • Enable the Timer Job rule in Prod.

I split the scenario into 2 examples, in the 1st example, I will work in Dev farm and disable all health Rules while in 2nd example I will disable a couple of rules and enable 1 rule in Production.

Example 1:

Let’s start with dev farm.

Get

1st we will list all health Rule in the farm. For that, we will run this command

Get-SPHealthAnalysisRule

You will get the output like this. it includes Name, ID, Enabled Status, Category and Summary of All rules. You can write them in a Txt file to better understanding.
he2

Disable:

Now we want to disable all Health Analysis rules. 

Get-SPHealthAnalysisRule | Disable-SPHealthAnalysisRule

This command will get the Health Rule and disable One by One. It asks you for the Confirmation and if you press “Y” then it will repeat this for rules but if You type “A” that’s mean you said, “Yes to All”( as I did). Output like this. Now if we want to check the status of the Rule then we have to reRun the get command like this.
he3

If you run the below get command then you will see the status of the rule.

Get-SPHealthAnalysisRule | select name enabled

You will see Enabled is False for all rules.
he4

Example # 2

In production, Krossfarm Administrator wants to disable the all the timer ContentDbsAreTooLarge, ReadOnlyDatabase and WindowsClassicTest and they want to enable the TimerRecycleFailed rule.

Get

Let’s disable all 3 Health rule one by one.

$HR = Get-SPHealthAnalysisRule ContentDbsAreTooLarge
Disable-SPHealthAnalysisRule $hr
Get-SPHealthAnalysisRule $HR

Output will be like this:
he5

Now repeat the above powerShell for other 2 rules, run below command for ReadOnlyDatabase

$HR = Get-SPHealthAnalysisRule ReadOnlyDatabase
Disable-SPHealthAnalysisRule $hr
Get-SPHealthAnalysisRule $HR

and the same thing for WindowsClassicTest

$HR = Get-SPHealthAnalysisRule WindowsClassicTest
Disable-SPHealthAnalysisRule $hr
Get-SPHealthAnalysisRule $HR


Enable:

Now we want to Enable the Timer Job Health Rule

$HR = Get-SPHealthAnalysisRule TimerRecycleFailed
Get-SPHealthAnalysisRule $HR
Disable-SPHealthAnalysisRule $HR
Output will be Like this( you can see the enable status is true now).
he6

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *