Creating a series of DNS records
creating a series of dns records
When standing up a new grid or cluster, static DNS records are often required. This example script will add A and in-arpa records for 20 hosts (ava-ks-1 to ava-ks-20) and map sequential, even-numbered, IP addresses starting with 10.111.160.40.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 4 -Modules DnsServer | |
$hostnameprefix = 'ava-ks-' | |
$ipnetstring = '10.111.160.' | |
$zonename = 'avamar.contoso.com' | |
$targetdnsserver = 'USKSDC2.Contoso.com' | |
(1..20).ForEach({Add-DnsServerResourceRecord -A -IPv4Address "$($ipnetstring)$(($_+19)*2)" -Name "$($hostnameprefix)$($_)" -ZoneName $zonename -CreatePtr -ComputerName $targetdnsserver}) | |
This post is licensed under CC BY 4.0 by the author.