wmiObjectSet := wmiServices.InstancesOf(sClass, wbemFlagReturnImmediately
or wbemQueryFlagShallow,
nil);
Enum := (wmiObjectSet._NewEnum)
as IEnumVariant;
bOk := False;
while (Enum.Next(1, ovVar, lwValue) = S_OK)
do begin
bOk := True;
wmiObject := IUnknown(ovVar)
as SWBemObject;
propSet := wmiObject.Properties_;
propEnum := (propSet._NewEnum)
as IEnumVariant;
while (propEnum.Next(1, ovVar, lwValue) = S_OK)
do begin
wmiProp := IUnknown(ovVar)
as SWBemProperty;
sValue := '
';
if VarIsNull(wmiProp.Get_Value)
then sValue := '
Is Null'
else
case wmiProp.CIMType
of
wbemCimtypeSint8,
wbemCimtypeUint8,
wbemCimtypeSint16,
wbemCimtypeUint16,
wbemCimtypeSint32,
wbemCimtypeUint32,
wbemCimtypeSint64:
if VarIsArray(wmiProp.Get_Value)
then begin
if VarArrayHighBound(wmiProp.Get_Value, 1) > 0
then begin
for Count := 1
to VarArrayHighBound(wmiProp.Get_Value, 1)
do begin
sValue := sValue + '
' + IntToStr(wmiProp.Get_Value[Count]);
end;
end;
end else sValue := IntToStr(wmiProp.Get_Value);
wbemCimtypeReal32,
wbemCimtypeReal64: sValue := FloatToStr(wmiProp.Get_Value);
wbemCimtypeBoolean:
if wmiProp.Get_Value
then sValue := '
True'
else sValue := '
False';
wbemCimtypeString,
wbemCimtypeUint64:
if VarIsArray(wmiProp.Get_Value)
then begin
if VarArrayHighBound(wmiProp.Get_Value, 1) > 0
then begin
for Count := 1
to VarArrayHighBound(wmiProp.Get_Value, 1)
do begin
sValue := sValue + '
' + wmiProp.Get_Value[Count];
end;
end;
end else begin
sValue := wmiProp.Get_Value;
end;
wbemCimtypeDatetime:
sValue := wmiProp.Get_Value;
else
begin
Try
sValue := wmiProp.Get_Value;
Except
on e :
Exception Do Begin
sValue := '
Wert kann nicht gelesen werden: ' + e.
Message;
end;
End;
end;
end;
sl.Add(wmiProp.
Name + '
=' + sValue);
End;