Link to home
Create AccountLog in
Avatar of Andy M
Andy MFlag for Croatia

asked on

DNS record powershell


Hello,

 

to explain what this script does.

It connects to the dns server  (192.168.1.20)

set dnsserver=192.168.1.20

It connects to A record test.domain.com which has the address 192.168.1.10 and deletes it

setfqdn=test.domain.com

After that, the same record test.domain.com is added but but with a different IP address

set hostB=192.168.1.11

 

In other words, this script changes the IP address for single A record on the Windows private DNS server

 https://woshub.com/create-manage-dns-zones-records-powershell/

What I am interested in is whether it is possible to do something like this for public DNS A record on cloudflare public dns server or google public dns server or cpanel dns server or any public dns server.

Has anyone changed records via a script on public dns servers?



 

REM *** Variables ***

 

set hostA=192.168.1.10

 

set hostB=192.168.1.11

 

set zone=domain.com

 

set fqdn=test.domain.com

 

set dnsserver=192.168.1.20

 

REM *** Change To Host B ***

 

REM Start new DNS Change in Zone domain.com

 

dnscmd %dnsserver% /RecordDelete %zone% %fqdn% 60 A %hostA% /f

 

dnscmd %dnsserver% /RecordAdd %zone% %fqdn% 60 A %hostB%

 

dnscmd %dnsserver% /clearcache

 

ipconfig /flushdns

ASKER CERTIFIED SOLUTION
Avatar of Michael Pfister
Michael Pfister
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer