IWSManSession::Enumerate method (wsmandisp.h)

Enumerates a table, data collection, or log resource. To create a query, include a filter parameter and a dialect parameter in an enumeration. You can also use an IWSManResourceLocator object to create queries. For more information, see Enumerating or Listing All the Instances of a Resource.

Syntax

HRESULT Enumerate(
  [in]           VARIANT   resourceUri,
  [in, optional] BSTR      filter,
  [in, optional] BSTR      dialect,
  [in]           long      flags,
  [out]          IDispatch **resultSet
);

Parameters

[in] resourceUri

The identifier of the resource to be retrieved.

The following list contains identifiers that this parameter can contain:

[in, optional] filter

A filter that defines what items in the resource are returned by the enumeration. When the resource is enumerated, only those items that match the filter criteria are returned. Including a filter parameter and a dialect parameter in an enumeration converts the enumeration into a query.

If you have an IWSManResourceLocator object for the resourceURI parameter, then this parameter should not be used. Instead, use the selector and fragment functionality of IWSManResourceLocator.

[in, optional] dialect

The language used by the filter. WQL, a subset of SQL used by WMI, is the only language supported.

If you have a IWSManResourceLocator object for the resourceURI parameter, then this parameter should not be used. Instead, use the selector and fragment functionality of IWSManResourceLocator.

[in] flags

This parameter must contain a flag in the __WSManEnumFlags enumeration. For more information, see Enumeration Constants.

[out] resultSet

An IWSManEnumerator object that contains the results of the enumeration.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Call IWSManSession::Enumerate to start an enumeration operation. Thereafter, call IWSManEnumerator::ReadItem using the returned IWSManEnumerator object until the end of items is indicated by the AtEndOfStream property.

Be aware that if the flags include the Enumeration Constants WSManFlagHierarchyDeepBasePropsOnly or WSManFlagHierarchyShallow then Windows Remote Management service returns the error code ERROR_WSMAN_POLYMORPHISM_MODE_UNSUPPORTED.

For more information about limiting network calls during an enumeration, see the BatchItems property.

If a filter is specified, it must be a valid document with respect to the schema of the resource. The dialect parameter is optional. However, if the filter string begins with <, but is not an XML fragment, then either include the dialect parameter or set the WSManFlagNonXmlText flag in the flags parameter. For more information, see Enumeration Constants.

The corresponding scripting method is Session.Enumerate.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wsmandisp.h
Library WSManDisp.tlb
DLL WSMAuto.dll

See also

IWSManEnumerator

IWSManSession

Session.Enumerate