Snippet Guides

New WMI 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\WMI. 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 WMI Namespace.

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 WMI namespace
Enter the WMI namespace or accept the default value. Press tab.


Enter WMI query
Enter the WMI query. Press tab.


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.


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.

Enter FieldName
For each property, enter the name of the field returned from the query. Press tab. Repeat this for each property of your class.



Press enter to stop editing. The discovery is now done.
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 WMI Namespace.

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 WMI namespace
Enter the WMI namespace or accept the default value. Press tab.


Enter WMI query
Enter the WMI query. Press tab.


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.


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.

Enter FieldName
For each property, enter the name of the field returned from the query. Press tab. Repeat this for each property of your class.



Press enter to stop editing. The discovery is now done.
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 host
Enter the correct host path to the NetworkName property. If Windows.Computer is used as a target class remoce the "Host/" from the path. The number of "Host" entries is determined by how your application component is hosted. Press tab.


Enter WMI namespace
Enter the WMI namespace or accept the default value. Press tab.


Enter WMI query
Enter the WMI query. Press tab.


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


Enter display name
Enter the how the display name of the discovered object should be popluated. Defaults to the same as the server name.

Note: Verify the path to the property if the default is used. The number of Host in the path is dependent on the target class. It should match what was entered in the Namespace tag.

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.

Enter FieldName
For each property, enter the name of the field returned from the query. Press tab. Repeat this for each property of your class.



Press enter to stop editing. The discovery is now done.
Save the file/project.


Version: 1.0
Created: 2016-06-02, 19:42