This documentation is archived and is not being maintained.

ManagementObjectSearcher Constructor

.NET Framework 1.1

Initializes a new instance of the ManagementObjectSearcher class.

Overload List

Initializes a new instance of the ManagementObjectSearcher class. After some properties on this object are set, the object can be used to invoke a query for management information. This is the default constructor.

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

Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query for management information.

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

Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query for management information.

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

Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query in the specified scope.

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

Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query in the specified scope.

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

Initializes a new instance of the ManagementObjectSearcher class to be used to invoke the specified query in the specified scope, with the specified options.

[Visual Basic] Public Sub New(ManagementScope, ObjectQuery, EnumerationOptions)
[C#] public ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions);
[C++] public: ManagementObjectSearcher(ManagementScope*, ObjectQuery*, EnumerationOptions*);
[JScript] public function ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions);

Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query, in the specified scope, and with the specified options.

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

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of the ManagementObjectSearcher constructor. For other examples that might be available, see the individual overload topics.
[C#] 
ManagementObjectSearcher s = new ManagementObjectSearcher(
    "root\\MyApp", 
    "SELECT * FROM MyClass", 
    new EnumerationOptions(null, InfiniteTimeout, 1, true, false, true);
   
[Visual Basic] 
Dim s As New ManagementObjectSearcher( _
    "root\MyApp", _
    "SELECT * FROM MyClass", _
    New EnumerationOptions(Null, InfiniteTimeout, 1, True, False, True)
   

[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

ManagementObjectSearcher Class | ManagementObjectSearcher Members | System.Management Namespace

Show: