I think you can change the "Automatically detect settings" via the registry key name "AutoConfigURL". here is the code that I check in c#. Wish you luck.
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
if(registry.GetValue("AutoConfigURL") != null)
{
//Proxy Server disabled (Untick Proxy Server)
registry.DeleteValue("AutoConfigURL");
}