Partager via


Creating a Health Add-In

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 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 (https://go.microsoft.com/fwlink/?LinkId=120542). For more information about using XML, see XML Overviews (https://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 template you can download.

  1. Confirm that you have installed the Windows Server Essentials SDK.

  2. In Visual Studio, click Tools, and then click Extensions and Updates….

  3. On the Extensions and Updates dialog, click Online, and then search for “Windows Server”.

  4. In the results pane, click on Windows Server Essentials Add-In Templates, and then click Download.

  5. On the Installation dialog, click Install, and then click Close.

    The WSS Health Add-In template should now be available on the New Project dialog, in the Templates directory.

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

  1. 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.

  2. Copy the Definition.xml and the Definition.xml.config files to the new folder.

  3. 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

  1. Open Task Scheduler.

  2. 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.