Export (0) Print
Expand All

ManagementTaskAttribute Class

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Exposes a task through a provider. An example of a management task is starting a process or stopping a service. The ManagementTask attribute marks methods that are exposed though an automation space, such as Windows Management Instrumentation (WMI). The exposed method completes the task.

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

[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false)]
public sealed class ManagementTaskAttribute : ManagementMemberAttribute
Not applicable.

A method that is marked with the ManagementTask attribute is defined by a verb. The verb gives the task its name and must be an approved management verb. If the task enumerates manageable objects, the method declaration should be marked with the ManagementEnumeration attribute.

The following example shows how to mark a method with the ManagementTask attribute to expose the method to WMI.

[C#]

// Use the ManagementTask attribute to specify that a method
// is exposed to WMI through this provider. Consumers will be
// able to execute this method through WMI.
[ManagementTask]
public void ResetCounters()
{
    counter.Reset();
}

System.Object
  System.Attribute
    System.Management.ManagementMemberAttribute
      System.Management.ManagementTaskAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Server 2003, Windows XP SP2, Windows Vista

The .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.5
Show:
© 2015 Microsoft