I had to create multiple A DNS records of the format below –
1 2 3 4 |
10.240.187.21 for svr01 10.240.187.22 for svr02 ... 10.240.187.29 for svr09 |
Just 9 records, I could create them manually, but I thought let’s try and create en-mass using PowerShell. If you are on Windows Server 2012 and above, you have PowerShell cmdlets for DNS.
So I did the following –
1 |
1..9 | %{ $num = $_; Add-DnsServerResourceRecord -ComputerName dnssvr -ZoneName myzone.com -A -CreatePtr -IPv4Address "10.240.187.2$num" -Name "svr0$num" } |
To confirm they are created, the following helps –
1 |
1..9 | %{ $num = $_; Get-DnsServerResourceRecord -ComputerName dnssvr -Name "svr0$num" -ZoneName myzone.com -RRType A } |
Nice!