I've got a new post up HERE on the System Center Forum site.
The title is "Advanced example using PowerShell and the OpsMgr SDK: Creating and Updating Groups". I basically translate a post from Jakub Olesky HERE.
I'm going to do a few more related blog posts where I split the above code into two functions/scripts.