Migration scripts to move Windows DNS to Digital Ocean DNS
The scripts included were used to help migrate from a DNS server on Windows 2008r2 to Digital Ocean DNS. Windows Server 2012 is required for the Digital Ocean Powershell module, but there are scripts to help import zone files from a 2008r2 server into 2012. They probably aren't the most efficient or handle all possible errors, I just tweaked them until they worked for our situation. Be sure to do a few test runs first and check the output/logs for errors, then use the script to erase Digital Ocean DNS test runs before the final migration. The scripts are intended for a 1 time migration, You can't run these scripts multiple times or you will create duplicate entries on Digital Ocean. Due to the number of DNS entries we had, I had to split up the scripts by DNS record type to avoid reaching the DigitalOcean API rate limit. Below you will find a description of each script sorted by the order you should run them in.
Requires the Digital Ocean Powershell module by KirkMunro https://github.com/KirkMunro/DoPx Run the following command in Powershell to verify module is installed: Get-Command -Module DoPx
You can skip this if you're already hosting DNS on a Server 2012/r2 machine.
- Open up DNS manager on your pre-2012 server, right click on forward lookup zones, select "Export list" and save dns-zones.csv.
- Right click your dns server and select "Update Server Data Files"
- Copy the zone files out of %SystemRoot%\System32\DNS\ into c:\tools\dns on the 2012 machine and dns-zones.csv into c:\tools
OPTIONAL - We had a lot of old domains that needed to be cleaned up. This script does a nameserver lookup on all DNS zones and checks if they are still pointing to your current nameservers. If a zone isn't using your dns server, a backup is exported and the zone is deleted from dns. Replace & with your current nameserver ip addresses.
OPTIONAL - Used to get a list of websites being hosted in IIS
OPTIONAL - Used with get-site-list.ps1 to find sites that aren't using your DNS server.
Copies your a records to Digital Ocean.
Copies cname records to Digital Ocean.
Copies mx records to Digital Ocean. If the domain is email only and wasn't added during the a record script, an error will be logged but the script will attempt to add the domain and mx record.
Copies txt records to Digital Ocean.
Copies srv records to Digital Ocean.
Copies ns records to Digital Ocean. Only needed if you want vanity nameservers, Digital Ocean automatically adds ns(1-3).digitalocean.com
WARNING! Erase all Digital Ocean DNS entries. Use during migration testing for a clean slate at Digital Ocean. Digital Ocean allows duplicate entries for some of these records so you'll have to run this to clear out your test runs before the actual migration.
WARNING! This will delete all dns zones on your Windows server. If you are importing zones from a different server and take a while during the testing phase, you can run this and repeat the dns import process to get a fresh set of records when you are ready to migrate.
Checks your DNS zone export list(minus cleaned up zones) to verify there is an entry at Digital Ocean after migration.
OPTIONAL - Checks hosted site domains from IIS site list to see if they are still using the old DNS server instead of DigitalOcean.