Here are some instructions how to change the Login / authentication mode via Code. It just uses plain SMO capabilites:

 Change the login mode

 

After this you will have to make sure that the Service is restarted, if you want this to do via SMO look at the following sample. You need to know the ServiceName your Service instance you want to restart is running:

 Restart the service with SMO / WMI

 

-Jens

The other options are mentioned here: http://www.sqlserver2005.de/Screencast/Screencast.aspx?ScreencastId=5