次の方法で共有


ManagementObject コンストラクタ (String, String, ObjectGetOptions)

指定したオプションを含む、指定した WMI パスにバインドする ManagementObject クラスの新しいインスタンスを初期化します。スコープとパスは、文字列として指定します。

名前空間: System.Management
アセンブリ: System.Management (system.management.dll 内)

構文

'宣言
Public Sub New ( _
    scopeString As String, _
    pathString As String, _
    options As ObjectGetOptions _
)
'使用
Dim scopeString As String
Dim pathString As String
Dim options As ObjectGetOptions

Dim instance As New ManagementObject(scopeString, pathString, options)
public ManagementObject (
    string scopeString,
    string pathString,
    ObjectGetOptions options
)
public:
ManagementObject (
    String^ scopeString, 
    String^ pathString, 
    ObjectGetOptions^ options
)
public ManagementObject (
    String scopeString, 
    String pathString, 
    ObjectGetOptions options
)
public function ManagementObject (
    scopeString : String, 
    pathString : String, 
    options : ObjectGetOptions
)

パラメータ

  • scopeString
    WMI オブジェクトのスコープ。
  • pathString
    WMI オブジェクト パス。
  • options
    WMI オブジェクトを取得するための追加のオプションを表す ObjectGetOptions

解説

詳細については、等価なオーバーロードのトピックを参照してください。

.NET Framework のセキュリティ

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

使用例

特定の WMI パスおよびオプションを使用して ManagementObject クラスの新しいインスタンスを初期化する例を次に示します。

Imports System
Imports System.Management

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

        Dim opt As New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True)
        Dim o As New ManagementObject( _
            "root\MyNamespace", "MyClass", opt)

        Return 0
    End Function
End Class
using System;
using System.Management;
   
class Sample
{
    public static int Main(string[] args) 
    {
        ObjectGetOptions opt = 
            new ObjectGetOptions(null, System.TimeSpan.MaxValue, true);
        ManagementObject o = 
            new ManagementObject(
            "root\\MyNamespace", "MyClass", opt);

        return 0;
    }
}

.NET Framework のセキュリティ

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

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

ManagementObject クラス
ManagementObject メンバ
System.Management 名前空間