It seems to me that ServiceController class (the once I used to manage my services) doesn’t support this kind of functionality.
After googling, I found this http://www.codeproject.com/cs/system/extendservicecontroller.asp
Basically, we have to use WMI for this task. Below is the sample code
public static void SetServiceStartupType(string serviceName,
StartupType startupType)
{
// construct the management path
string path = string.Format("Win32_Service.Name='{0}'", serviceName);
ManagementPath mPath = new ManagementPath(path);
// construct the management object
ManagementObject obj = new ManagementObject(mPath);
object[] parameters = new object[1];
parameters[0] = startupType.ToString();
obj.InvokeMethod("ChangeStartMode", parameters);
}
There is a very good tool to generate WMI code that we can download from
http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en