Alex
Alex

Reputation: 77329

Use WMI to create DNS entries

Is it possible to create DNS entries using WMI (Windows Management Instrumentation)?

Thank you

Upvotes: 1

Views: 1999

Answers (1)

ichiban
ichiban

Reputation: 6200

Maybe this could help: Add DNS Resource

EDIT: Here's a VBScript snippet that might be useful

 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);

Upvotes: 2

Related Questions