Question WMI DNS Change Zone using ChangeZoneType

aniallator

New member
Joined
May 12, 2009
Messages
1
Programming Experience
Beginner
Hi there,

I am trying to use the changezonetype wmi command to change a DNS zone from secondary to primary. I can create a zone but everytime i call this piece of code below to change the zone type i get an error saying invalid parameter. Has anyone done this before?? Any ideas would be useful.

VB.NET:
            Dim mgrZones As ManagementObjectCollection = WMISearcher.Get
            For Each DNSZone As ManagementObject In mgrZones
                mngrZones = DNSZone.GetMethodParameters("ChangeZoneType")
                mngrZones("ZoneType") = zoneType
                DNSZone.InvokeMethod("ChangeZoneType", mngrZones, Nothing)
                Return True
            Next

It connects to the dns server and returns the domains but errors when i invoke the changezonetype line.

Thanks
 
Last edited:
Back
Top