Problem scenario
You want to create multiple A records in DNS. But to do it manually using the MMC would take too long. What should you do?
Solution
- Open the MMC and browse Active Directory. On the left the name of the A.D. server should be fairly obvious (e.g., contint or foobarsrv).
- Open PowerShell as an administrator.
- Create a .txt file called arecords.txt with this as the header:
name,ip
- Underneath that header place DNS names followed by a comma and a space, and finally the associated IP address. Have one DNS name and IP address pair per line.
- Change directories to where you have saved this .txt file.
- Run this command, but substitute contint for the name of the DNS server:
Import-Csv .\arecords.txt | foreach{Add-DnsServerResourceRecordCName -Name $_.name -ZoneName test.local -HostNameAlias $_.cname -ComputerName contint}
- You are done. It may take a few minutes for the DNS records to appear. This solution above was adapted from this posting.