update ip in a record

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
harrygunter
Posts: 1
Last visit: Thu Aug 02, 2007 6:40 pm

update ip in a record

Post by harrygunter »

Hi all,
Can someone point me in the right direction or has anyone a script that will remotely change a host record ip address on an win2003 pri dns server? I need this for a failover DR box.
I've managed to create a new A record, now I just need to find out how to delete the existing record first.
Is this the way to do it or is there a way to just modify the existing record?

strDNSServer = "dnsserverip"strContainer = "domainname.com"strOwner = "host.domainname.com"intRecordClass = 1intTTL = 600 strIPAddress = "hostip" strComputer = "dnsserverip"Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" & strComputer & _ "rootMicrosoftDNS")
Set objItem = objWMIService.Get("MicrosoftDNS_AType")errResult = objItem.CreateInstanceFromPropertyData _ (strDNSServer, strContainer, strOwner, intRecordClass, _ intTTL, strIPAddress)

Cheers
harrygunter2007-08-03 06:28:29
This topic is 16 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked