次の方法で共有


ManagementScope.Connect メソッド

ManagementScope を実際の WMI スコープに接続します。

Public Sub Connect()
[C#]
public void Connect();
[C++]
public: void Connect();
[JScript]
public function Connect();

解説

このメソッドは、接続する必要がある操作でスコープが使用される場合、暗黙的に呼び出されます。接続時間を制御する場合は、このメソッドを明示的に呼び出します。

使用例

 
ManagementScope s = new ManagementScope("root\\MyApp");

//Explicit call to connect the scope object to the WMI namespace
s.Connect();

//The following doesn't do any implicit scope connections because s is already connected.
ManagementObject o = new ManagementObject(s, "Win32_LogicalDisk='C:'", null);
   
[Visual Basic] 
Dim s As New ManagementScope("root\\MyApp")

'Explicit call to connect the scope object to the WMI namespace
s.Connect()

'The following doesn't do any implicit scope connections because s is already connected.
Dim o As New ManagementObject(s, "Win32_LogicalDisk=""C:""", null)
   

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

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