ManagementObjectSearcher ManagementObjectSearcher ManagementObjectSearcher ManagementObjectSearcher Class

Definition

Retrieves a collection of management objects based on a specified query. This class is one of the more commonly used entry points to retrieving management information. For example, it can be used to enumerate all disk drives, network adapters, processes and many more management objects on a system, or to query for all network connections that are up, services that are paused, and so on. When instantiated, an instance of this class takes as input a WMI query represented in an ObjectQuery or its derivatives, and optionally a ManagementScope representing the WMI namespace to execute the query in. It can also take additional advanced options in an EnumerationOptions. When the Get() method on this object is invoked, the ManagementObjectSearcher executes the given query in the specified scope and returns a collection of management objects that match the query in a ManagementObjectCollection.

public ref class ManagementObjectSearcher : System::ComponentModel::Component
public class ManagementObjectSearcher : System.ComponentModel.Component
type ManagementObjectSearcher = class
    inherit Component
Public Class ManagementObjectSearcher
Inherits Component
Inheritance
ManagementObjectSearcherManagementObjectSearcherManagementObjectSearcherManagementObjectSearcher

Constructors

ManagementObjectSearcher() ManagementObjectSearcher() ManagementObjectSearcher() ManagementObjectSearcher()

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.

ManagementObjectSearcher(ManagementScope, ObjectQuery) ManagementObjectSearcher(ManagementScope, ObjectQuery) ManagementObjectSearcher(ManagementScope, ObjectQuery) ManagementObjectSearcher(ManagementScope, ObjectQuery)

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

ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions) ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions) ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions) ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions)

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

ManagementObjectSearcher(ObjectQuery) ManagementObjectSearcher(ObjectQuery) ManagementObjectSearcher(ObjectQuery) ManagementObjectSearcher(ObjectQuery)

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

ManagementObjectSearcher(String) ManagementObjectSearcher(String) ManagementObjectSearcher(String) ManagementObjectSearcher(String)

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

ManagementObjectSearcher(String, String) ManagementObjectSearcher(String, String) ManagementObjectSearcher(String, String) ManagementObjectSearcher(String, String)

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

ManagementObjectSearcher(String, String, EnumerationOptions) ManagementObjectSearcher(String, String, EnumerationOptions) ManagementObjectSearcher(String, String, EnumerationOptions) ManagementObjectSearcher(String, String, EnumerationOptions)

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

Properties

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

Gets a value indicating whether the component can raise an event.

(Inherited from Component)
Container Container Container Container

Gets the IContainer that contains the Component.

(Inherited from Component)
DesignMode DesignMode DesignMode DesignMode

Gets a value that indicates whether the Component is currently in design mode.

(Inherited from Component)
Events Events Events Events

Gets the list of event handlers that are attached to this Component.

(Inherited from Component)
Options Options Options Options

Gets or sets the options for how to search for objects.

Query Query Query Query

Gets or sets the query to be invoked in the searcher (that is, the criteria to be applied to the search for management objects).

Scope Scope Scope Scope

Gets or sets the scope in which to look for objects (the scope represents a WMI namespace).

Site Site Site Site

Gets or sets the ISite of the Component.

(Inherited from Component)

Methods

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Component.

(Inherited from Component)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(Inherited from Component)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Get() Get() Get() Get()

Invokes the specified WMI query and returns the resulting collection.

Get(ManagementOperationObserver) Get(ManagementOperationObserver) Get(ManagementOperationObserver) Get(ManagementOperationObserver)

Invokes the WMI query asynchronously, and binds to a watcher to deliver the results.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

Returns an object that represents a service provided by the Component or by its Container.

(Inherited from Component)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.

(Inherited from Component)

Events

Disposed Disposed Disposed Disposed

Occurs when the component is disposed by a call to the Dispose() method.

(Inherited from Component)

Applies to