ManagementObjectSearcher Class

 

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.

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

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Management.ManagementObjectSearcher

public class ManagementObjectSearcher : Component

NameDescription
System_CAPS_pubmethodManagementObjectSearcher()

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.

System_CAPS_pubmethodManagementObjectSearcher(ManagementScope, ObjectQuery)

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

System_CAPS_pubmethodManagementObjectSearcher(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.

System_CAPS_pubmethodManagementObjectSearcher(ObjectQuery)

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

System_CAPS_pubmethodManagementObjectSearcher(String)

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

System_CAPS_pubmethodManagementObjectSearcher(String, String)

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

System_CAPS_pubmethodManagementObjectSearcher(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.

NameDescription
System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyOptions

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

System_CAPS_pubpropertyQuery

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

System_CAPS_pubpropertyScope

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

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Inherited from Component.)

NameDescription
System_CAPS_pubmethodCreateObjRef(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.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Inherited from Component.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_pubmethodGet()

Invokes the specified WMI query and returns the resulting collection.

System_CAPS_pubmethodGet(ManagementOperationObserver)

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

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodToString()

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

NameDescription
System_CAPS_pubeventDisposed

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

.NET Framework
Available since 1.1

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

Return to top
Show: