Creating a Health Add-In
Published: December 17, 2010
Updated: October 9, 2012
Applies To: Windows Home Server 2011, Windows Server 2012 Essentials, Windows Small Business Server 2011 Essentials, Windows Storage Server 2008 R2 Essentials
A health add-in provides definitions for alerts, health checks, and repairs for network problems. A health add-in consists of xml files that annotate code or data that is used to evaluate health information for a specific feature.
Important |
|---|
| The examples in this section include creating a file called Definition.xml to contain the health definitions. It is permissible to change these user-defined Definition.xml files, but it is not permissible to change the Definition.xml files that are delivered with the product. |
Note |
|---|
| A health definition can be included in other add-ins and is not required to be an individual add-in. Health add-in logs for diagnosing user issues with creating health add-ins are located in the %ProgramData%\Microsoft\Windows Server\Logs folder with a file name beginning with NetworkHealthPlugin- followed by the add-in name. |
The code that is included in a health add-in can be a PowerShell script or managed code. To learn more about using PowerShell, download the Windows PowerShell 1.0 Documentation Pack (http://go.microsoft.com/fwlink/?LinkId=120542). For more information about using XML, see XML Overviews (http://go.microsoft.com/fwlink/?LinkId=120543).
Setting up the development environment
You can develop a health add-in on your own development computer or you can develop a health add-in on a test server. The examples in this section use Visual Studio 2010 and take advantage of a template that is provided with the SDK. placed in the ProjectTemplates folder for Visual Studio 2010.
The template is named HSBSHealthAddin.zip (which is contained in the Alerts folder) and should be copied from the SDK to My Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#. You can copy the Alerts folder to the Templates folder if you prefer to keep the folder structure.
To make adding XML elements easier, the following schemas are added to the template:
-
FeatureSchema.xsd
-
FeatureConfigurationSchema.xsd
Creating the health add-in files
A health add-in consists of a Definition.xml file and a Definition.xml.config file. See the following subsections for information about how to create the XML files that are needed for a health add-in:
Installing the health add-in files
After you create the xml files, you must place a copy of the files in the appropriate location on the server and client computers.
To install the xml files on the server
-
In the %ProgramFiles%\Windows Server\Bin\FeatureDefinitions folder, create a new folder named MyHealthAddIn. You can give this folder any name. It is suggested that the name of the folder be the same as the feature name.
-
Copy the Definition.xml and the Definition.xml.config files to the new folder.
-
If you created binary files for conditions or actions, you should also copy those files to %ProgramFiles%\Windows Server\Bin.
Client computers run a scheduled task every 6 hours that pulls the XML files to the appropriate location. You can force the synchronization between the client computer and the server by manually running the task.
To install the xml files on the client computer
-
Open Task Scheduler.
-
Run the HealthDefintionUpdateTask in Task Scheduler.
Note This task does not install binary files. You must manually copy the binary files to the %ProgramFiles%\Windows Server\Bin folder on the client computer.