ManagementPath クラス
定義
WMI (Windows Management Instrumentation) オブジェクトへのパスを解析および構築するためのラッパーを提供します。Provides a wrapper for parsing and building paths to WMI objects.
public ref class ManagementPath : ICloneable
public class ManagementPath : ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Management.ManagementPathConverter))]
public class ManagementPath : ICloneable
type ManagementPath = class
interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Management.ManagementPathConverter))>]
type ManagementPath = class
interface ICloneable
Public Class ManagementPath
Implements ICloneable
- 継承
-
ManagementPath
- 属性
- 実装
例
次の例は、 ManagementPath クラスが WMI オブジェクトへのパスを解析する方法を示しています。The following example demonstrates how the ManagementPath class parses a path to a WMI object. この例で解析されるパスは、クラスのインスタンスへのパスです。The path that is parsed in the example is a path to an instance of a class.
using System;
using System.Management;
public class Sample
{
public static void Main()
{
// Get the WMI class path
ManagementPath p =
new ManagementPath(
"\\\\ComputerName\\root" +
"\\cimv2:Win32_LogicalDisk.DeviceID=\"C:\"");
Console.WriteLine("IsClass: " +
p.IsClass);
// Should be False (because it is an instance)
Console.WriteLine("IsInstance: " +
p.IsInstance);
// Should be True
Console.WriteLine("ClassName: " +
p.ClassName);
// Should be "Win32_LogicalDisk"
Console.WriteLine("NamespacePath: " +
p.NamespacePath);
// Should be "ComputerName\cimv2"
Console.WriteLine("Server: " +
p.Server);
// Should be "ComputerName"
Console.WriteLine("Path: " +
p.Path);
// Should be "ComputerName\root\cimv2:
// Win32_LogicalDisk.DeviceId="C:""
Console.WriteLine("RelativePath: " +
p.RelativePath);
// Should be "Win32_LogicalDisk.DeviceID="C:""
}
}
Imports System.Management
Public Class Sample
Public Overloads Shared Function _
Main(ByVal args() As String) As Integer
' Get the WMI class path
Dim p As ManagementPath = _
New ManagementPath( _
"\\ComputerName\root" & _
"\cimv2:Win32_LogicalDisk.DeviceID=""C:""")
Console.WriteLine("IsClass: " & _
p.IsClass)
' Should be False (because it is an instance)
Console.WriteLine("IsInstance: " & _
p.IsInstance)
' Should be True
Console.WriteLine("ClassName: " & _
p.ClassName)
' Should be "Win32_LogicalDisk"
Console.WriteLine("NamespacePath: " & _
p.NamespacePath)
' Should be "ComputerName\cimv2"
Console.WriteLine("Server: " & _
p.Server)
' Should be "ComputerName"
Console.WriteLine("Path: " & _
p.Path)
' Should be "ComputerName\root\cimv2:
' Win32_LogicalDisk.DeviceId="C:""
Console.WriteLine("RelativePath: " & _
p.RelativePath)
' Should be "Win32_LogicalDisk.DeviceID="C:""
End Function
End Class
コンストラクター
ManagementPath() |
ManagementPath クラスの新しい空のインスタンスを初期化します。Initializes a new instance of the ManagementPath class that is empty. これはパラメーターなしのコンストラクターです。This is the parameterless constructor. |
ManagementPath(String) |
特定パスの ManagementPath クラスの新しいインスタンスを初期化します。Initializes a new instance of the ManagementPath class for the given path. |
プロパティ
ClassName |
パスのクラス部分を取得または設定します。Gets or sets the class portion of the path. |
DefaultPath |
スコープが指定されない場合に使用する既定のスコープ パスを取得または設定します。Gets or sets the default scope path used when no scope is specified. 既定のスコープは \\.\root\cimv2 ですが、このプロパティを設定することで変更できます。The default scope is \\.\root\cimv2, and can be changed by setting this property. |
IsClass |
クラス パスかどうかを示す値を取得または設定します。Gets or sets a value indicating whether this is a class path. |
IsInstance |
インスタンス パスかどうかを示す値を取得または設定します。Gets or sets a value indicating whether this is an instance path. |
IsSingleton |
シングルトン インスタンス パスかどうかを示す値を取得または設定します。Gets or sets a value indicating whether this is a singleton instance path. |
NamespacePath |
パスの名前空間部分を取得または設定します。Gets or sets the namespace part of the path. 別個に取得できるサーバー名は含まれていないことに注意してください。Note that this does not include the server name, which can be retrieved separately. |
Path |
オブジェクトの完全パスの文字列形式を取得または設定します。Gets or sets the string representation of the full path in the object. |
RelativePath |
相対パス、つまりクラス名とキーだけを取得または設定します。Gets or sets the relative path: class name and keys only. |
Server |
パスのサーバー部分を取得または設定します。Gets or sets the server part of the path. |
メソッド
Clone() |
ManagementPath のコピーを返します。Returns a copy of the ManagementPath. |
Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object. (継承元 Object) |
GetHashCode() |
既定のハッシュ関数として機能します。Serves as the default hash function. (継承元 Object) |
GetType() |
現在のインスタンスの Type を取得します。Gets the Type of the current instance. (継承元 Object) |
MemberwiseClone() |
現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object. (継承元 Object) |
SetAsClass() |
新しいクラス パスとしてパスを設定します。Sets the path as a new class path. つまり、パスにキー値ではなく、クラス名を要求します。This means that the path must have a class name but not key values. |
SetAsSingleton() |
新しいシングルトン オブジェクト パスとしてパスを設定します。Sets the path as a new singleton object path. つまり、これはインスタンスへのパスですが、キー値はありません。This means that it is a path to an instance but there are no key values. |
ToString() |
オブジェクトの完全パスを文字列形式として返します。Returns the full object path as the string representation. |
明示的なインターフェイスの実装
ICloneable.Clone() |
現在のインスタンスのコピーである新しいオブジェクトを作成します。Creates a new object that is a copy of the current instance. |