使用WMI创建DNS条目

时间:2009-05-31 21:52:16

标签: dns wmi

是否可以使用WMI(Windows Management Instrumentation)创建DNS条目?

谢谢

1 个答案:

答案 0 :(得分:2)

也许这可能有所帮助: Add DNS Resource

编辑:以下是可能有用的VBScript snippet

 var sHostName = "SomeMachine"
 var strRRsufix    = ". IN A 192.168.51.200";  //some ip address
 var strRR= sHostName + strRRsufix;
 var objDNS       = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\MicrosoftDNS");
 var objRR        = objDNS.Get("MicrosoftDNS_ResourceRecord");
 var objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name=\".\"");
 objRR.CreateInstanceFromTextRepresentation(objDNSServer.Name, strDomain, strRR);