SWbemObject.Derivation_ 属性

SWbemObject 对象的 Derivation\_ 属性包含描述被引用实例的类派生层次结构的字符串数组。 数组中的第一个元素定义父类,最后一个元素定义 dynasty 类。 此属性为只读。

有关此语法的说明,请参阅脚本 API 的文档约定

此属性为只读。

语法

SWbemObject.Derivation_ As String

属性值

示例

以下 VBScript 示例介绍如何检索 win32_logicaldisk 的类层次结构。

on Error resume next

Set c = GetObject("winmgmts://./root/cimv2:win32_logicaldisk")
d = c.Derivation_

for x = LBound(d) to UBound(d)
 WScript.Echo d(x)
Next

if err <> 0 then
 WScript.Echo Err.Description
end if

以下 Perl 示例介绍如何检索 win32_logicaldisk 的类层次结构。

use strict;
use Win32::OLE;

my ($C, $D, @collection);

eval {$C = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2")->
  InstancesOf ("win32_logicaldisk") };
unless ($@) 
{
 @collection = in $C;
 eval {$D = $collection[0]->Derivation_();};
 print "\n";
 unless ($@) 
 {
  print map{"$_\n"} @{$D};
 }
 else
 {
  print STDERR Win32::OLE->LastError, "\n";
 }
}
else
{
 print STDERR Win32::OLE->LastError, "\n";
}

要求

要求
最低受支持的客户端
Windows Vista
最低受支持的服务器
Windows Server 2008
标头
Wbemdisp.h
类型库
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemObject
IID
IID_ISWbemObject