Creating OpsMgr 2007 Groups Programmatically

I’ve recently given a couple of examples of how to create groups that will dynamically include the health service watcher object and also how to create groups based on my sample custom MP that will populate based on AD security group membership.  Both of these examples required editing the XML directly to insert the proper group membership expression.  Brian Wren writes an excellent blog post about how to create groups programmatically.  You sill need the correct expression to build out group membership but it may be a bit nicer for some than having to sift through the raw management pack XML.