Snippet Guides

New Registry Discovery

Before you begin: Before creating a new discovery you need to decide on a discovery ID and a display name. You should also think about what properties you should discover for the class.

For more information, consult the Management Pack Content document, section Workflow/Element naming.

Discovery naming



If the project is not open in Visual Studio, open it.
Find the folder for the class that you want to discover.


Add new item
Right-click the folder and choose Add\New Item....
In the list, select Empty Management Pack Fragment.



Enter fragment name
Enter a name for the fragment. This should be the same the folder with the addition of Discovery. So if the folder name is ApplicationServerComputerRole the new fragment should be named ApplicationServerComputerRoleDiscovery. Click Add. The fragment is created and opened.


Choose snippet
Right-click between the <ManagementPackFragment> tags and select Insert snippet. Choose MPDevToolkit\Discoveries\Registry. Choose which type of class you want to discover (Computer Role, Local Application, Application Component) and the number of properties.

The snippet is inserted. Follow the appropriate instructions below.

Computer Role
Local Application
Application Component




Computer Role


Enter MPID
Enter the MPID and press tab. Enter the description part of the class name. This should be the same name as the fragment where the class was defined. Press tab.


If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this step and continue with Registry Key Name.

Enter property ID
Enter the name for the first property. To use Intellisense, press Backspace and then Ctrl+Space and select the correct one. Press tab. Repeat this for each property of your class.


Enter registry key name
Enter the name of the registry key that the discovery should look for. Existance of this key determins if the class should be created.

Note The AttributeName can't contain any spaces or dots. So if the registry key contains spaces they must be removed when entered here. But in the path tag the key name must be exact so you have to replace them again.

Press tab. Enter the subkey of HKLM. It defaults to SOFTWARE. Press tab. Enter the registry path to the key. Press tab.

Note The snippet automatically has added the key name to the end of the path.


If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this stepp and continue with Frequency.

Enter property value name, path and type
Enter the name of the registry value that should populate the property. Press tab.
Enter the registry path to the value,

Note: The snippet automatically has added the value name to the end of the path. Press tab.

Choose the type of value. It should be one of the following:

  • 1 - String: converting result value to string.
  • 2 - Integer: converting result value to number.
  • 3 - Float: converting result value to float.

Press tab. Repeat this for each property of your class.


Enter frequency
Enter the frequency in seconds with which the discovery should run. Press tab.


Press enter to stop editing. The discovery is now done.

Note If your registry key contains any spaces, check the registry paths again to verify that they are correct. Also check the path in the discovery description.

Save the file/project.




Local Application


Enter MPID
Enter the MPID and press tab. Enter the description part of the class name. This should be the same name as the fragment where the class was defined. Press tab.


If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this step and continue with Registry Key Name.

Enter property ID
Enter the name for the first property. To use Intellisense, press Backspace and then Ctrl+Space and select the correct one. Press tab. Repeat this for each property of your class.


Enter registry key name
Enter the name of the registry key that the discovery should look for. Existance of this key determins if the class should be created.

Note The AttributeName can't contain any spaces or dots. So if the registry key contains spaces they must be removed when entered here. But in the path tag the key name must be exact so you have to replace them again.

Press tab. Enter the subkey of HKLM. It defaults to SOFTWARE. Press tab. Enter the registry path to the key. Press tab.

Note The snippet automatically has added the key name to the end of the path.


If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this stepp and continue with Frequency.

Enter property value name, path and type
Enter the name of the registry value that should populate the property. Press tab.
Enter the registry path to the value,

Note: The snippet automatically has added the value name to the end of the path. Press tab.

Choose the type of value. It should be one of the following:

  • 1 - String: converting result value to string.
  • 2 - Integer: converting result value to number.
  • 3 - Float: converting result value to float.

Press tab. Repeat this for each property of your class.


Enter frequency
Enter the frequency in seconds with which the discovery should run. Press tab.


Press enter to stop editing. The discovery is now done.

Note If your registry key contains any spaces, check the registry paths again to verify that they are correct. Also check the path in the discovery description.

Save the file/project.




Application Component


Enter MPID
Enter the MPID and press tab. Enter the description part of the class name. This should be the same name as the fragment where the class was defined. Press tab.


Enter target Enter the target class for the discovery. To use Intellisense, press Backspace and then Ctrl+Space and select the correct one. Press tab.


Enter property ID
Enter the name for the first property. To use Intellisense, press Backspace and then Ctrl+Space and select the correct one. Press tab. Repeat this for each property of your class.


Enter registry key name
Enter the name of the registry key that the discovery should look for. Existance of this key determins if the class should be created.

Note The AttributeName can't contain any spaces or dots. So if the registry key contains spaces they must be removed when entered here. But in the path tag the key name must be exact so you have to replace them again.

Press tab. Enter the subkey of HKLM. It defaults to SOFTWARE. Press tab. Enter the registry path to the key. Press tab.

Note The snippet automatically has added the key name to the end of the path.


If you have choosen a snippet for a class with one or more properties, do the following step for each property. Otherwise, skip this stepp and continue with Frequency.

Enter property value name, path and type
Enter the name of the registry value that should populate the property. Press tab.
Enter the registry path to the value,

Note: The snippet automatically has added the value name to the end of the path. Press tab.

Choose the type of value. It should be one of the following:

  • 1 - String: converting result value to string.
  • 2 - Integer: converting result value to number.
  • 3 - Float: converting result value to float.

Press tab. Repeat this for each property of your class.


Enter frequency
Enter the frequency in seconds with which the discovery should run. Press tab.


Enter display name
Enter the display name of the object. Defaults to the targets display name. Press tab.


Press enter to stop editing. The discovery is now done.

Note If your registry key contains any spaces, check the registry paths again to verify that they are correct. Also check the path in the discovery description.

Save the file/project.

Version: 1.0
Created: 2016-05-30, 08:12