MgmtClassGenTask Class

Summary

A task that generates strongly typed WMI classes using mgmtclassgen.exe.
Assembly
NAnt.Contrib.dll
Namespace
NAnt.Contrib.Tasks
Base Types
  • ExternalProgramBase
graph BT Type-->Base0["ExternalProgramBase"] Type["MgmtClassGenTask"] class Type type-node

Syntax

[TaskName("mgmtclassgen")]
public class MgmtClassGenTask : ExternalProgramBase

Examples

    <mgmtclassgen 
    wmiclass="Win32_LogicalDisk" 
    language="CS"
    machine="SomeMachine"
    path="Root\cimv2"
    namespace="Winterdom.WMI"
    out="${outputdir}\LogicalDisk.cs"
    username="Administrator"
    password="password"
/>

Remarks

The Management Strongly Typed Class Generator enables you to quickly generate an early-bound managed class for a specified Windows Management Instrumentation (WMI) class. The generated class simplifies the code you must write to access an instance of the WMI class.

Attributes

Type Description
TaskName

Properties

Name Value Summary
Language string
Specifies the language in which to generate the class. Possible values are: CS, VB, JS
Machine string
Specifies the machine to connect to.
Namespace string
Namespace of the generated .NET class
OutFile string
Path of the file to generate
Password string
Password to use when connecting to the specified machine
Path string
Specifies the path to the WMI namespace that contains the class.
ProgramArguments string
Arguments of program to execute
ProgramFileName string
Filename of program to execute
Username string
User name to use when connecting to the specified machine
WmiClass string
Specifies the name of the WMI class to generate the strongly typed class

Methods

Name Value Summary
ExecuteTask() void
This is where the work is done
Initialize() void
Initializes task and ensures the supplied attributes are valid.