使用 WMI ChangeZoneType 将 DNS 区域从辅助区域更改为主要区域
以前有人在 C#\VB.net 中使用过 WMI ChangeZoneType DNS 命令吗? 当我尝试调用 changezonetype 命令时,出现错误参数异常。 我从 dns 服务器获取要更改的 dns 区域(通过查询),将 zonetype 设置为适当的 uint 值,但随后出现异常。 我正在尝试将区域从辅助区域更改为主要区域,并根据 MSDN 所有其他值都是可选的(据我所知,当您想从主要更改为辅助时需要),因此我没有包含它们。
下面是我正在使用的代码......
For Each DNSZone As ManagementObject In mgrZones
mngrZones = DNSZone.GetMethodParameters("ChangeZoneType")
mngrZones("ZoneType") = System.Convert.ToUInt32(zoneType)
DNSZone.InvokeMethod("ChangeZoneType", mngrZones, Nothing)
Next
有人有任何想法吗?
谢谢
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 MSDN 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.
Below is the code that i am using....
For Each DNSZone As ManagementObject In mgrZones
mngrZones = DNSZone.GetMethodParameters("ChangeZoneType")
mngrZones("ZoneType") = System.Convert.ToUInt32(zoneType)
DNSZone.InvokeMethod("ChangeZoneType", mngrZones, Nothing)
Next
Anyone got any ideas?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在寻找了一些答案后,我尝试了以下方法并且它有效。
尼尔
After looking around for some answers i tried the following and it worked.
Niall