ManagementObject.Scope プロパティ

定義

オブジェクトが存在するスコープを取得または設定します。

public:
 property System::Management::ManagementScope ^ Scope { System::Management::ManagementScope ^ get(); void set(System::Management::ManagementScope ^ value); };
public System.Management.ManagementScope Scope { get; set; }
member this.Scope : System.Management.ManagementScope with get, set
Public Property Scope As ManagementScope

プロパティ値

オブジェクトが存在するスコープです。

次の例では、 クラスの新しいインスタンスを ManagementObject 既定の名前空間で初期化し、 のスコープを ManagementObject変更します。

using System;
using System.Management;
public class Sample
{
    public static void Main()
    {
        // Create the object with the default namespace
        // (root\cimv2)
        ManagementObject o = new ManagementObject();

        // Change the scope (=namespace) of this object
        // to the one specified.
        o.Scope = new ManagementScope("root\\CIMV2");
    }
}
Imports System.Management
Public Class Sample

    Public Overloads Shared Function Main( _
    ByVal args() As String) As Integer

        ' Create the object with the default namespace
        ' (root\cimv2)
        Dim o As New ManagementObject

        ' Change the scope (=namespace) of this object
        ' to the one specified.
        o.Scope = New ManagementScope("root\CIMV2")

        Return 0
    End Function
End Class

注釈

管理オブジェクトが特定の名前空間の WMI オブジェクトにバインドされた後にこのプロパティを変更すると、元の WMI オブジェクトが解放されます。 これにより、管理オブジェクトは、新しいパスプロパティとスコープ値で指定された新しいオブジェクトにリバウンドされます。

再バインドは"遅延" 方式で実行されます。つまり、要求された値で管理オブジェクトを WMI オブジェクトにバインドする必要がある場合にのみ実行されます。 再バインドを試みる前に、このプロパティ以上に変更を加えることができます (たとえば、スコープとパスのプロパティを同時に変更するなど)。

.NET Framework のセキュリティ

直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「 部分信頼コードからのライブラリの使用」を参照してください。

適用対象