- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the If condition I run through all the portgroups until I find the one that belongs to the correct vSwitch and has the correct portgroupname.
Then I copy the specifications of that portgroup ($pg.spec) to a new variable ($spec).
The only thing we want to to change is the name of the portgroup. That's the $spec.name = $newpgname statement.
And finally I call the UpdatePortGroup method to actuallt make the change.
I could have put the 2 last statements in the If block but since I expect only 1 portgroup on a specific vSwitch with a specific name I can put those 2 statements also outside the If block.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference