title: Change DNS Zone from secondary to Primary with WMI ChangeZoneType
body: <p>Has anyone used the WMI ChangeZoneType DNS command in C#\VB.net before. I get an incorrect parameter exception when i try and invoke the changezonetype command. I get the dns zone that i want to change from the dns server (via query), set the zonetype to the appropriate uint value but am then getting the exception. I am trying to change the zone from secondary to primary and according to <a href="http://msdn.microsoft.com/en-us/library/ms682759(VS.85).aspx" rel="nofollow noreferrer">MSDN</a> all the other values are optional (and as far as i am aware are needed when you want to change from primary to secondary) so i have not included them.</p>
  
  <p>Below is the code that i am using....</p>
  
  <pre><code>        For Each DNSZone As ManagementObject In mgrZones
              mngrZones = DNSZone.GetMethodParameters("ChangeZoneType")
              mngrZones("ZoneType") = System.Convert.ToUInt32(zoneType)
              DNSZone.InvokeMethod("ChangeZoneType", mngrZones, Nothing)
          Next
  </code></pre>
  
  <p>Anyone got any ideas?</p>
  
  <p>Thanks</p>