I ran across a great blog article on setting up a split DNS (Domain Name System) zone this morning. It got me to thinking though, can I do this in PowerShell? The answer is yes. And it is quicker than using the DNS management console. Change the zone name and IP address to match the name and server IP respectively.
- Add-DnsServerPrimaryZone <test.mydomain.com> -ReplicationScope “Forest”
- Add-DnsServerResourceRecord -A -Name “.” -ZoneName <test.mydomain.com> -IPv4Address <18.104.22.168>
If you have a way of doing this command in one line I want to hear about it. Post it in the comments below.