ManagementObjectSearcher 類別

定義

根據指定的查詢擷取管理物件的集合。Retrieves a collection of management objects based on a specified query. 這個類別是其中一個較為經常用來擷取管理資訊的進入點 (Entry Point)。This class is one of the more commonly used entry points to retrieving management information. 例如,它可以用來列舉所有磁碟機、網路介面卡 (Adapter)、處理序和系統上其他更多的管理物件,或用來查詢所有正在使用的網路連接、暫停的服務,等等。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. 執行個體化時,這個類別的執行個體會將 ObjectQuery 或其系出物件所表示的 WMI 查詢當做輸入,也會選擇性將表示執行查詢所在 WMI 命名空間的 ManagementScope 當做輸入。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. 此外,它在 EnumerationOptions 中可以接受額外的進階選項。It can also take additional advanced options in an EnumerationOptions. 叫用這個物件的 Get() 方法時,ManagementObjectSearcher 會在指定範圍中執行指定的查詢,並傳回 ManagementObjectCollection 中符合查詢的管理物件集合。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
繼承
ManagementObjectSearcher

建構函式

ManagementObjectSearcher()

初始化 ManagementObjectSearcher 類別的新執行個體。Initializes a new instance of the ManagementObjectSearcher class. 在設定這個物件的某些屬性之後,該物件就可以用來叫用 (Invoke) 管理資訊的查詢。After some properties on this object are set, the object can be used to invoke a query for management information. 這是無參數建構函式。This is the parameterless constructor.

ManagementObjectSearcher(ManagementScope, ObjectQuery)

初始化 ManagementObjectSearcher 類別新執行個體,這個執行個體是用來叫用指定範圍中的指定查詢。Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query in the specified scope.

ManagementObjectSearcher(ManagementScope, ObjectQuery, EnumerationOptions)

使用所指定的選項,初始化 ManagementObjectSearcher 類別的新執行個體,這個執行個體是用來叫用指定範圍的指定查詢。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 類別的新執行個體,這個執行個體是用來叫用指定的管理資訊查詢。Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query for management information.

ManagementObjectSearcher(String)

初始化 ManagementObjectSearcher 類別的新執行個體,這個執行個體是用來叫用指定的管理資訊查詢。Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query for management information.

ManagementObjectSearcher(String, String)

初始化 ManagementObjectSearcher 類別新執行個體,這個執行個體是用來叫用指定範圍中的指定查詢。Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query in the specified scope.

ManagementObjectSearcher(String, String, EnumerationOptions)

使用所指定的選項,初始化 ManagementObjectSearcher 類別的新執行個體,這個執行個體是用來叫用指定範圍的指定查詢。Initializes a new instance of the ManagementObjectSearcher class used to invoke the specified query, in the specified scope, and with the specified options.

屬性

CanRaiseEvents

取得值,指出元件是否能引發事件。Gets a value indicating whether the component can raise an event.

(繼承來源 Component)
Container

取得包含 IContainerComponentGets the IContainer that contains the Component.

(繼承來源 Component)
DesignMode

取得值,指出 Component 目前是否處於設計模式。Gets a value that indicates whether the Component is currently in design mode.

(繼承來源 Component)
Events

取得附加在這個 Component 上的事件處理常式清單。Gets the list of event handlers that are attached to this Component.

(繼承來源 Component)
Options

取得或設定如何搜尋物件的選項。Gets or sets the options for how to search for objects.

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

取得或設定尋找物件時要針對的範圍 (範圍表示 WMI 命名空間)。Gets or sets the scope in which to look for objects (the scope represents a WMI namespace).

Site

取得或設定 ComponentISiteGets or sets the ISite of the Component.

(繼承來源 Component)

方法

CreateObjRef(Type)

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(繼承來源 MarshalByRefObject)
Dispose()

釋放 Component 所使用的所有資源。Releases all resources used by the Component.

(繼承來源 Component)
Dispose(Boolean)

釋放 Component 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(繼承來源 Component)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Get()

叫用指定的 WMI 查詢,並傳回產生的集合。Invokes the specified WMI query and returns the resulting collection.

Get(ManagementOperationObserver)

非同步叫用 WMI 查詢,並繫結至監看員,以便傳送結果。Invokes the WMI query asynchronously, and binds to a watcher to deliver the results.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetLifetimeService()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
GetService(Type)

傳回表示 Component 或其 Container 所提供之服務的物件。Returns an object that represents a service provided by the Component or by its Container.

(繼承來源 Component)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
InitializeLifetimeService()

取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance.

(繼承來源 MarshalByRefObject)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
MemberwiseClone(Boolean)

建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object.

(繼承來源 MarshalByRefObject)
ToString()

傳回任何包含 Component 名稱的 StringReturns a String containing the name of the Component, if any. 不應覆寫此方法。This method should not be overridden.

(繼承來源 Component)

事件

Disposed

當此元件由 Dispose() 方法的呼叫處置時發生。Occurs when the component is disposed by a call to the Dispose() method.

(繼承來源 Component)

適用於