Snippet Guides

New Windows Script Performance Collection Rule

Before you begin: Before creating a new rule you need to decide on a rule ID and a display name.

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

Rule naming

If the project is not open in Visual Studio, open it.

Note: If there's no prior reference to the following management pack it must be added:
Right-click the References folder in the project and select Add reference. Browse to the management pack and select it. Verify that the aliases are the correct by checking properties on each reference:


Add new item
Find the folder for the class that you want to create a rule for. 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 as as the description part of the rule name plus the word CollectionRule. So if the rule description is UserConnections the new fragment should be named UserConnectionsCollectionRule. Click Add. The fragment is created and opened.

Pick snippet
Right-click between the <ManagementPackFragment> tags and select Insert snippet. Choose MPAuthoring\Rules\Collection Rules\ and select the Script Performance snippet.
The code is inserted.

Enter MPID
Enter the MPID and press tab.
Enter the the description part of the rule name. Press tab.

Enter script name
Enter the name of the script. Press tab.

Note: The script should be placed in the projects script folder.

Enter timeout
Enter the timeout in seconds. Press tab.

Enter target
Enter the target class. To use intellisense, press Backspace and then Ctrl+Space. Press tab.

Enter configuration
Enter the Object name and press tab. The Counter name and press tab. Enter the instance name and press tab. Enter the interval which the script should be run, in seconds. Press tab.

Enter the rule display name
Enter the rule display name and a description.
Press tab.

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

Save the file/project.

Version: 1.0
Created: 2016-08-09, 15:24