Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Understanding Collections - WMI PropertyDataCollection

$
0
0

Hi!

I'm trying to get my head around how Powershell collections work and I'm having trouble finding the answer. Specifically I'm exploring WMI share objects, and looking at the qualifiers in order to understand how the key qualifier can be used for filtering.

First I get a share object as so:

PS C:\ian> $share = gwmi win32_share

This returns a list of share objects. Each object has a property called 'properties' which lists details about the various share properties, including the qualifiers. The field is a collection.

PS C:\ian> $share[0].properties.gettype()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    PropertyDataCollection                   System.Object

What's confusing me is that I can't do something like this:

$props = $share[0].properties

$props[0] | fl *

It's basically a non-indexed array of objects. I've looked for a clear definition of how a collection like this works but haven't found a good answer. Can someone point me to a resource on how collections work?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>