title: How do I set the Alternate DNS server?
body: <p>I'm trying to set the <strong>Alternate DNS Server</strong> using .NET. I have managed to set the main DNS server by using this bit of code.</p>
  
  <pre><code>ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
                  ManagementObjectCollection moc = mc.GetInstances();
                  foreach (ManagementObject mo in moc)
                  {
                      if ((bool)mo["IPEnabled"])
                      {
                          ManagementBaseObject objdns = mo.GetMethodParameters("SetDNSServerSearchOrder");
                          if (objdns != null)
                          {
                              string[] s = { "127.0.0.1" };
                              objdns["DNSServerSearchOrder"] = s;
                              mo.InvokeMethod("SetDNSServerSearchOrder", objdns, null);
                          }
                      }
                  }
  </code></pre>
  
  <p>Now I need to figure out how to set the Alternate DNS Server. Please help. Thanks in advance!</p>