This documentation is archived and is not being maintained.

ManagementObject Constructor

.NET Framework 1.1

Initializes a new instance of the ManagementObject class.

Overload List

Initializes a new instance of the ManagementObject class. This is the default constructor.

[Visual Basic] Public Sub New()
[C#] public ManagementObject();
[C++] public: ManagementObject();
[JScript] public function ManagementObject();

Initializes a new instance of the ManagementObject class for the specified WMI object path. The path is provided as a ManagementPath.

[Visual Basic] Public Sub New(ManagementPath)
[C#] public ManagementObject(ManagementPath);
[C++] public: ManagementObject(ManagementPath*);
[JScript] public function ManagementObject(ManagementPath);

Initializes a new instance of the ManagementObject class for the specified WMI object path. The path is provided as a string.

[Visual Basic] Public Sub New(String)
[C#] public ManagementObject(string);
[C++] public: ManagementObject(String*);
[JScript] public function ManagementObject(String);

Initializes a new instance of the ManagementObject class bound to the specified WMI path, including the specified additional options.

[Visual Basic] Public Sub New(ManagementPath, ObjectGetOptions)
[C#] public ManagementObject(ManagementPath, ObjectGetOptions);
[C++] public: ManagementObject(ManagementPath*, ObjectGetOptions*);
[JScript] public function ManagementObject(ManagementPath, ObjectGetOptions);

Initializes a new instance of the ManagementObject class that is serializable.

[Visual Basic] Public Sub New(SerializationInfo, StreamingContext)
[C#] public ManagementObject(SerializationInfo, StreamingContext);
[C++] public: ManagementObject(SerializationInfo*, StreamingContext);
[JScript] public function ManagementObject(SerializationInfo, StreamingContext);

Initializes a new instance of the ManagementObject class bound to the specified WMI path, including the specified additional options. In this variant, the path can be specified as a string.

[Visual Basic] Public Sub New(String, ObjectGetOptions)
[C#] public ManagementObject(string, ObjectGetOptions);
[C++] public: ManagementObject(String*, ObjectGetOptions*);
[JScript] public function ManagementObject(String, ObjectGetOptions);

Initializes a new instance of the ManagementObject class bound to the specified WMI path that includes the specified options.

[Visual Basic] Public Sub New(ManagementScope, ManagementPath, ObjectGetOptions)
[C#] public ManagementObject(ManagementScope, ManagementPath, ObjectGetOptions);
[C++] public: ManagementObject(ManagementScope*, ManagementPath*, ObjectGetOptions*);
[JScript] public function ManagementObject(ManagementScope, ManagementPath, ObjectGetOptions);

Initializes a new instance of the ManagementObject class bound to the specified WMI path, and includes the specified options. The scope and the path are specified as strings.

[Visual Basic] Public Sub New(String, String, ObjectGetOptions)
[C#] public ManagementObject(string, string, ObjectGetOptions);
[C++] public: ManagementObject(String*, String*, ObjectGetOptions*);
[JScript] public function ManagementObject(String, String, ObjectGetOptions);

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of the ManagementObject constructor. For other examples that might be available, see the individual overload topics.
[C#] 
GetObjectOptions opt = new GetObjectOptions(null, true);
ManagementObject o = new ManagementObject("root\\MyNamespace", "MyClass.Name='abc'", opt);
   
[Visual Basic] 
Dim opt As New GetObjectOptions(null, true)
Dim o As New ManagementObject("root\MyNamespace", "MyClass.Name=""abc""", opt);
   

[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.

See Also

ManagementObject Class | ManagementObject Members | System.Management Namespace

Show: