生および書式設定されたパフォーマンス データ オブジェクトのドキュメントの取得

次のトピックでは、動的に作成された生または書式設定されたデータ オブジェクトのオンライン プログラミング ドキュメントを取得する方法について説明します。

WMI には、パフォーマンスを追跡する多数のオブジェクトが含まれています。 Win32_PerfRawData から派生したクラスには、生つまり "加工されていない" パフォーマンス データが含まれており、パフォーマンス カウンター プロバイダーによってサポートされています。 これに対し、Win32_PerfFormattedData から派生したクラスには、"加工済み" つまり書式設定されたデータが含まれており、書式設定されたパフォーマンス データ プロバイダーでサポートされています。

ただし、どちらのプロバイダーでも、動的に作成された多数の子クラスがサポートされます。 プロパティは実行時に追加されるため、これらのクラスには文書化されていないプロパティが含まれている可能性があります。 次のコードを使用して、動的に作成された特定のクラスのプロパティを識別できます。

動的に作成されたクラスの説明を取得するには

  1. 項目のインスタンスを作成し、修正された修飾子を true に設定します。

    $osClass = New-Object System.Management.ManagementClass Win32_ClassNameHere  
    $osClass.Options.UseAmendedQualifiers = $true
    
  2. クラスのプロパティを取得します。

    $properties = $osClass.Properties  
    "This class has {0} properties as follows:" -f $properties.count
    
  3. プロパティを表示します。

    foreach ($property in $properties) {  
    "Property Name: {0}" -f $property.Name  
    "Description:   {0}" -f $($property.Qualifiers["Description"].Value)  
    "Type:          {0}" -f $property.Type  
    "-------"
    }
    

次のコードでは、指定した Win32_PerfFormattedData オブジェクトのプロパティの説明を取得します。

$osClass = New-Object System.Management.ManagementClass Win32_PerfFormattedData_APPPOOLCountersProvider_APPPOOLWAS  
$osClass.Options.UseAmendedQualifiers = $true  
  
# Get the Properties in the class  
$properties = $osClass.Properties  
"This class has {0} properties as follows:" -f $properties.count  
  
  
# display the Property name, description, type, qualifiers and instance values  
  
foreach ($property in $properties) {  
"Property Name: {0}" -f $property.Name  
"Description:   {0}" -f $($property.Qualifiers["Description"].Value)  
"Type:          {0}" -f $property.Type  
"-------"  
}