For a lot of methods that require a "spec" object, the object is already there in some other objects.
That's what I did here, in the NetworkSystem object all portgroups are there.
With a loop I check them all and just copy the correct HostPortGroup object.
Then I just change the property (in this case the name) that is needed and feed it is a parameter to the UpdatePortGroup method.
Hope this clarifies a bit hwat the script does.