Delete Method

PerformanceCounterCategory.Delete Method

Removes the category and its associated counters from the local computer.

[Visual Basic]
Public Shared Sub Delete( _
   ByVal categoryName As String _
public static void Delete(
 string categoryName
public: static void Delete(
 String* categoryName
public static function Delete(
   categoryName : String


The name of the custom performance counter category to delete.


Exception Type Condition
ArgumentNullException The categoryName parameter is a null reference (Nothing in Visual Basic).
ArgumentException The categoryName parameter has invalid syntax. It might contain backslash characters ("\") or have length greater than 80 characters.
Win32Exception A call to an underlying system API failed.
InvalidOperationException The category cannot be deleted because it is not a custom category.


You can delete only custom performance counter categories from the system. You cannot delete a counter from a category. To do so, delete the category and recreate the category with the counters you want to retain.


Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

PerformanceCounterCategory Class | PerformanceCounterCategory Members | System.Diagnostics Namespace | Create

© 2016 Microsoft