description | ms.assetid | ms.tgt_platform | title | ms.topic | ms.date | topic_type | api_name | api_type | api_location | |
---|---|---|---|---|---|---|---|---|---|---|
A collection is a standard automation concept that provides a uniform interface to a set of objects over which you can perform iteration. |
c1ebe529-33cb-4158-923d-124d6328fc60 |
multiple |
Accessing a WMI Collection |
article |
05/31/2018 |
|
A collection is a standard automation concept that provides a uniform interface to a set of objects over which you can perform iteration. The Scripting API for WMI exposes a number of interfaces that conform to the collection paradigm. In each case, use the Item method to identify the elements using a string containing the value.
The SWbemPropertySet, SWbemQualifierSet, and SWbemMethodSet collections are mostly used to modify schema. An SWbemObjectSet object contains WMI objects, such as a Win32_LogicalDisk instance, that have been obtained through calls, such as SWbemServices.InstancesOf or SWbemObject.Associators_. The SWbemRefresher object can only contain instances of WMI classes. The SWbemNamedValueSet object may contain WMI objects or any other type of data that a provider requires for the method call.
Note
The following topics were written primarily for VBScript. C# uses the standard IEnumerable interface to collate and enumerate objects. In contrast, PowerShell generally uses an implicit object collection whenever a return value contains more than one result.
The following table lists the collections in the Scripting API for WMI and the elements and parameters for each collection.
Collection | Element | Item() Parameter |
---|---|---|
SWbemObjectSet | SWbemObject | Object path |
SWbemPropertySet | SWbemProperty | Property name |
SWbemQualifierSet | SWbemQualifier | Qualifier name |
SWbemMethodSet | SWbemMethod | Method name |
SWbemNamedValueSet | SWbemNamedValue | Value name |
SWbemPrivilegeSet | SWbemPrivilege | Privilege name |
SWbemRefresher | SWbemRefreshableItem | Index of the item in the SWbemRefresher object |
For more information about and examples of adding and removing items from a collection, see Removing a Single Item from a Collection and Removing Multiple Items from a Collection. For more information about working with classes, see Manipulating Class and Instance Information.