Create a sharepoint site and add an owner using code

I need to write some code to create a sharepoint site, create a specific Member, Visitor, and Owners group and add a user to the owner's group.
I have the code to create the site, but I can't figure out how to create the 3 groups and add a user to one of the groups.
Capt_RonIT Solutions ManagerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

sabby447Connect With a Mentor Commented:
Some more :

I will try in my environment as well to see if this works .. Just sharing to get you started as well
Capt_RonIT Solutions ManagerAuthor Commented:
Do you know of a version of this using VB or C#?
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Not in total however here is a pointer which may help you : 
KoenVostersConnect With a Mentor Commented:
You have to use the SpGroup class:
Adding users is done with the AddUser method:
Capt_RonIT Solutions ManagerAuthor Commented:
Between the two, I was able to figure it out.  Thanks.
All Courses

From novice to tech pro — start learning today.