Export (0) Print
Expand All

Deleting Performance Counter Categories

You can delete performance counter categories when they are no longer needed. You can only delete categories that are not Windows-standard performance objects; that is, you can only delete categories that have been user-defined. In addition, you cannot create or delete categories on remote computers. You might delete a category if you have created a custom category associated with an application and you are removing that application from the system. For example, if you have an order entry application that creates counters in an OrderProcessing category, you would delete that category as part of uninstalling your application.

You use the Delete method on the PerformanceCounterCategory class to remove a category from the system. When you delete a category, all of the counters and instances associated with it are also removed.

It is important to note the difference between deleting a counter and deleting an instance of the PerformanceCounter component. When you use the Delete method, you are deleting a category and its associated counters from the Windows operating system, rather than removing an instance of a counter from your project or application. When you delete an instance of the PerformanceCounter component, you remove a component inside your project that references an external counter.

Note   The PerformanceCounter class is not fully supported on Microsoft Windows NT version 4.0. You can read from the system counters, but you cannot create, write to, or delete custom counters.

To delete a performance counter category from Server Explorer

  1. In Server Explorer, locate the performance counter category you want to remove. For more information, see Accessing and Initializing Server Explorer.
    Note   The Servers node of Server Explorer is not available in the Standard Edition of Visual Basic and Visual C# .NET. For more information, see Visual Basic Standard Edition Features or Visual C# Standard Edition Features.
  2. Right-click the category and select Delete.

To delete a performance counter category programmatically

  • Call the Delete method on the PerformanceCounterCategory class, specifying the category to remove as a parameter.

See Also

Category and Counter Management | Adding and Removing Performance Counter Instances

Show:
© 2014 Microsoft