This documentation is archived and is not being maintained.

InstrumentationType Enumeration

Specifies the type of instrumentation provided by a class.

[Visual Basic]
<Serializable>
Public Enum InstrumentationType
[C#]
[Serializable]
public enum InstrumentationType
[C++]
[Serializable]
__value public enum InstrumentationType
[JScript]
public
   Serializable
enum InstrumentationType

Members

Member name Description
Abstract Specifies that the class defines an abstract class for management instrumentation.
Event Specifies that the class provides events for management instrumentation.
Instance Specifies that the class provides instances for management instrumentation.

Example

[C#] 
using System;
using System.Management;
using System.Configuration.Install;
using System.Management.Instrumentation;

// This example demonstrates how to create a Management Event class by using
// the InstrumentationClass attribute and to fire a Management Event from
// managed code.

// Specify which namespace the Management Event class is created in
[assembly:Instrumented("Root/Default")]

// Let the system know you will run InstallUtil.exe utility against
// this assembly
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller {}

// Create a Management Instrumentation Event class
[InstrumentationClass(InstrumentationType.Event)]
public class MyEvent
{
    public string EventName;
}

public class WMI_InstrumentedEvent_Example
{
    public static void Main() {
        MyEvent e = new MyEvent();
        e.EventName = "Hello";
        
        // Fire a Management Event
        Instrumentation.Fire(e);
        
        return;
    }
}
   
[Visual Basic] 
Imports System
Imports System.Management
Imports System.Configuration.Install
Imports System.Management.Instrumentation

' This sample demonstrates how to create a Management Event class by using
' the InstrumentationClass attribute and to fire a Management Event from
' managed code.

' Specify which namespace the Manaegment Event class is created in
<assembly: Instrumented("Root/Default")>

' Let the system know InstallUtil.exe utility will be run against
' this assembly
<System.ComponentModel.RunInstaller(True)> _
Public Class MyInstaller
    Inherits DefaultManagementProjectInstaller
End Class 'MyInstaller

' Create a Management Instrumentation Event class
<InstrumentationClass(InstrumentationType.Event)> _ 
Public Class MyEvent
    Public EventName As String
End Class

Public Class Sample_EventProvider
    Public Shared Function Main(args() As String) As Integer
        Dim e As New MyEvent()
        e.EventName = "Hello"
        
        ' Fire a Management Event
        Instrumentation.Fire(e)
        
        Return 0
    End Function
End Class
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Management.Instrumentation

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

Assembly: System.Management (in System.Management.dll)

See Also

System.Management.Instrumentation Namespace

Show: