Changing the Login / Authentication Mode programmtically via SMO

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



The other options are mentioned here: