I do it this way:
I look for components of type PIN, then look for a "Net Name" property on the component. In our process, our power/ground symbols use the "Net Name" property to define the net label.
Not sure if this applies to my problem. Imagine a +5V supplying four components but with a ferrite bead in each component's Vcc. Then I want to check in a script if the four (possibly unnamed) nets between the beads and the component pins have been assigned a POWER net class, so that the layouter knows e.g. that very thin wires are not appropriate here.