Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, April 24, 2008 2:12 AM
HI all...
I have asked, and asked, and asked this question and there is not one person out their in the last two years, and I am not stretching it here, that can help me.
I currently have the DNS server roll on server 2003 enabled and it is currently responsible for resolving 400+ domains.
I have a fresh server 2008 OS, and it's legal , that I am just dieing to put on my DNS machine. That is the only roll for this Server 2008 is the DNS server.
Here is the closest thing that makes since to anything that i have done in the past. Copy all the .dns records fron the DNS directory in the system32 window folders. Paste the .dns files / records into the newly installed Server 2008 dns folder and hit refresh in the DNS server snapin and one WOULD THING that they would be visible at this point.
Can someone tell me how to import my .dns files /records to a new install?
I just know I am missing something becuase to think that one would have to manually configure each domain all over again is loco...
How do I get the domains from one server to another.???? BULK update
Thanks a lot!
Erik
All replies (12)
Thursday, April 24, 2008 4:15 PM
I just accomplished a large move with dnscmd.exe. Look at the following switches:
/EnumZones
/ZoneExport
/ZoneAdd
I don't know what kind of zones you're moving so I can't give you specifics. This should get you started, though.
Friday, April 25, 2008 4:22 PM
Hi snickered !
I am excited about your response !
I am adding
Forward lookup zones
Reverse Lookup Zones
Got any pointers before I dive into this ?
Thanks A lot !
Erik
Tuesday, April 29, 2008 2:10 AM
Sorry it took so long to get back to you. If you haven't already gotten this thing sorted I can give you a few pointers (and maybe more) if you tell me what kind of forward lookup zones you're creating. Primary? Secondary? Etc...
Tuesday, April 29, 2008 7:04 PM
Hey,
Not yet,,,, I am working on something else until I get a full grasp on what needs to be done.
These are primary zones: forwards and reverse lookups
Thanks a million man!!!
Erik
Friday, May 2, 2008 2:40 PM | 1 vote
Alright man... I've been quite busy myself. Moving everything to Server 2008, Exchange 2007 and Vista is no walk in the park.
There is some manual work to this but not too much... it sure beats doing all this one by one.
The basic idea is that you want to script the process of creating a primary zone and get all of the .dns files from the old server to the new server. So, here's what I did.
First, I ran 'dnscmd OLDSERVER /enumzones > zones.txt' I opened zones.txt with Excel and only kept the names of the domains I wanted to transfer in one column. With my method you can only do one type at a time. So, be sure that you only keep the primary lookup zones. That includes removing the ad-integrated zones. So, now that you have a nice clean list of zones you want to move insert a column to the left of that column. In that column we will put 'dnscmd OLDSERVER /zoneexport' Now in a column to the right of our clean list we want to put the text 'BU\ (I'll tell you why in a minute). And to the right of that column you should copy the clean list and paste it there also. And finally on the far right you will want a column that says '.dns'. Once you have your Excel spreadsheet good to go you should save it as a comma-delimited file. That will give you a lot of rows that look like the following when you open it in notepad (I use notepad++):
dnscmd OLDSERVER /zoneexport, somedomain1.com, BU\ somedomain1.com, .dns
dnscmd OLDSERVER /zoneexport, somedomain2.com, BU\ somedomain2.com, .dns
dnscmd OLDSERVER /zoneexport, somedomain3.com, BU\ somedomain3.com, .dns
Now what you'll want to do is get rid of the commas and ready for a batfile. So, you can use notepad to "find/replace" things like '/zoneexport,' with '/zoneexport' and ', BU\ ' with ' BU\ ' and also ', .dns' with '.dns'. Once you do this correctly you will have a file like this:
dnscmd OLDSERVER /zoneexport somedomain1.com BU\somedomain1.com.dns
dnscmd OLDSERVER /zoneexport somedomain2.com BU\somedomain2.com.dns
dnscmd OLDSERVER /zoneexport somedomain3.com BU\somedomain3.com.dns
You can see that you can just drop this into a batfile and run it. But before you do so you need to create a folder on OLDSERVER with the path 'C:\Windows\System32\dns\BU' because that's where you are exporting all of your primary zones to. I realize that you could just copy all of the zones straight out of 'C:\Windows\System32\dns\ but in my situation I didn't only have primary zones. And while importing you want to keep different types of zones together because there is a different command to import them.
Alright, now you have a bunch of files on OLDSERVER that say 'somedomain1.com.dns' 'somedomain2.com.dns' etc... in 'C:\Windows\System32\dns\BU'. You want to drop those directly on NEWSERVER in the folder 'C:\Windows\System32\dns\. Then it's time to make the import script. We will mess around with Excel and notepad again.
This time we want a list of the filenames and domains so I got this by running 'dir /b > domains.txt' on NEWSERVER in the 'C:\Windows\System32\dns\ directory. Now you need to import domains.txt into excel and get a nice list of filenames. You want to create a comma-delimited file that looks like this:
dnscmd NEWSERVER /zoneadd, somedomain1.com.dns, /primary /file, somedomain1.com.dns, /load
dnscmd NEWSERVER /zoneadd, somedomain2.com.dns, /primary /file, somedomain2.com.dns, /load
dnscmd NEWSERVER /zoneadd, somedomain3.com.dns, /primary /file, somedomain3.com.dns, /load
At this point you can use "find/replace" to make it look like the following.
dnscmd NEWSERVER /zoneadd somedomain1.com /primary /file somedomain1.com.dns /load
dnscmd NEWSERVER /zoneadd somedomain2.com /primary /file somedomain2.com.dns /load
dnscmd NEWSERVER /zoneadd somedomain3.com /primary /file somedomain3.com.dns /load
Be sure you have the parameter right after /zoneadd be the domain name without the '.dns' at the end and the parameter after /file to be the actual filename that you just dropped in 'C:\Windows\System32\dns\ with the .dns on the end.
So, basically you are jury rigging an excel file to create a couple of big batfiles and manually moving some text files. You should try this with a dummy domain first. Here's the basic steps with a domain called 'foobar.com' going from OLDSERVER to NEWSERVER.
1. Create a folder called "BU" on OLDSERVER.
2. Run 'dnscmd OLDSERVER /zoneexport foobar.com BU\foobar.com.dns'
3. Move 'C:\Windows\System32\dns\BU\foobar.com.dns' from OLDSERVER to 'C:\Windows\System32\dns\foobar.com.dns' on NEWSERVER
4. Run 'dnscmd NEWSERVER /zoneadd foobar.com /primary /file foobar.com.dns /load'
You might be thinking that 'foobar.com.dns' isn't a full path. But that's how dnscmd does it. It looks directly in 'C:\Windows\System32\dns\ first. Once you have done the /zoneadd you can right click on the domain and choose reload. If it goes without error then you're set.
Good luck... read carefully... you'll get it.
Saturday, August 23, 2008 6:22 AM
Well I am back and my gun is loaded with a little code that will surely help anyone out there needing to move or change out machines and having to update all the existing domain names and their records.
I have also include the code needed to update all the exiting host ip addresses in IIS7.0 as well.
**Please do adjustments to the code to better fit your needs
Code to make new bat file that will change the IP address from the old ones to the new ones. When you run this on the new DNS sever machine this bat file should do all the work for you.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace GenericProcessor
{
//Review this document to understand better
//http://technet.microsoft.com/en-us/library/cc772069.aspx
class Program
{
//The location where you have copied and pasted the existing domains. **I put mine in the command prompt app root
const string _dnsFilesLoc = @"C:\Users\Administrator\Documents\Visual Studio 2008\Projects\GenericProcessor\GenericProcessor\dns\;
static void Main(string[] args)
{
//Replace old IPs with new IPs();
ReplaceIPs();
//Make the new .bat file with the newly update IP addresses
MakeBatFileForZoneLoad();
}
static void ReplaceIPs()
{
string newFile = string.Empty;
string[] dnsFiles = Directory.GetFiles(_dnsFilesLoc);
foreach (string oldFile in dnsFiles)
{
newFile = File.ReadAllText(oldFile);
newFile = newFile.Replace("33.33.85.82", "44.77.44.178");
newFile = newFile.Replace("33.33.85.83", "44.77.44.179");
File.WriteAllText(oldFile, newFile);
}
}
static void MakeBatFileForZoneLoad()
{
//dnscmd 11.111.111.11 /zoneadd AFCC.Ws /primary /file AFCC.Ws.dns /load
string dnsCmdFormat = "dnscmd 11.11.111.11 /zoneadd {0} /primary /file {0}.dns /load";
string dnsCmd = string.Empty;
StringBuilder batFile = new StringBuilder();
string[] dnsFiles = Directory.GetFiles(_dnsFilesLoc);
foreach (string file in dnsFiles)
{
dnsCmd = string.Format(dnsCmdFormat, Path.GetFileName(file).Replace(".dns", ""));
batFile.Append(dnsCmd);
batFile.Append(Environment.NewLine);
}
//Make the bat file on disk and save all the new dns commands to this bat file
File.WriteAllText(_dnsFilesLoc + "dnsZones.bat", batFile.ToString());
}
}
}
Example .bat file results
dnscmd 77.77.33.178 /zoneadd 75026.Info /primary /file 75026.Info.dns /load
dnscmd 77.77.33.178 /zoneadd 75034.Biz /primary /file 75034.Biz.dns /load
dnscmd 77.77.33.178 /zoneadd 75035.Biz /primary /file 75035.Biz.dns /load
dnscmd 77.77.33.178 /zoneadd 75070.Info /primary /file 75070.Info.dns /load
dnscmd 77.77.33.178 /zoneadd 75086.Info /primary /file 75086.Info.dns /load
dnscmd 77.77.33.178 /zoneadd 75094.Info /primary /file 75094.Info.dns /load
dnscmd 77.77.33.178 /zoneadd AFCC-Inc.Com /primary /file AFCC-Inc.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AFCC.Name /primary /file AFCC.Name.dns /load
dnscmd 77.77.33.178 /zoneadd AFCC.Ws /primary /file AFCC.Ws.dns /load
dnscmd 77.77.33.178 /zoneadd AFCC1.Com /primary /file AFCC1.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AFCCInc.Com /primary /file AFCCInc.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AFCCInc.Net /primary /file AFCCInc.Net.dns /load
dnscmd 77.77.33.178 /zoneadd AFCCIncPortals.Com /primary /file AFCCIncPortals.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AMERICANHOMEBUILDERS.INFO /primary /file AMERICANHOMEBUILDERS.INFO.dns /load
dnscmd 77.77.33.178 /zoneadd Americas-Builder.Com /primary /file Americas-Builder.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AmericasFinestBuilder.Com /primary /file AmericasFinestBuilder.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AmericasFinestHomeBuilder.Com /primary /file AmericasFinestHomeBuilder.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AmericasFinestHomeBuilders.Com /primary /file AmericasFinestHomeBuilders.Com.dns /load
dnscmd 77.77.33.178 /zoneadd AmericasFinestHomes.Biz /primary /file AmericasFinestHomes.Biz.dns /load
dnscmd 77.77.33.178 /zoneadd APARTMENTBUILDERS.NET /primary /file APARTMENTBUILDERS.NET.dns /load
dnscmd 77.77.33.178 /zoneadd ApplianceCompanies.Net /primary /file ApplianceCompanies.Net.dns /load
Code to update all the IIS7.0 Host IP addresses from the old machine IPs to the new IPs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Web.Administration;
using System.Net;
namespace IIS70WebAdmin
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ServerManager sm = new ServerManager();
foreach (Microsoft.Web.Administration.Site site in sm.Sites)
{
if (site != null)
{
if (site.Name != "Default Web Site")
{
if (site.Bindings != null)
{
string host = site.Bindings[0].Host;
if (host==string.Empty)goto Next;
host=host.Replace("WWW.","");
host=host.Replace("www.","");
string bindingInfo = site.Bindings[0].BindingInformation;
if (!bindingInfo.StartsWith("11.11.29.179"))
{
bindingInfo = bindingInfo.Replace("71.170.85.83", "11.11.29.179");
bindingInfo = bindingInfo.Replace("www.", "");
bindingInfo = bindingInfo.Replace("WWW.", "");
site.Bindings.Clear();
site.Bindings.Add(bindingInfo, "http");
bindingInfo = bindingInfo.Replace(host, "www." + host);
site.Bindings.Add(bindingInfo, "http");
}
}
}
}
Next: ;
}
sm.CommitChanges();
}
}
Erik
http://afccinc.com?siteref=msdn
Tuesday, May 12, 2009 4:35 PM
Hi, thanks for your answer that seems of a help to a similar problem I have, but I have tried to run 'dnscmd OLDSERVER /enumzones > zones.txt', it gives me an empty zones.txt file.
Wednesday, May 13, 2009 12:53 AM
+ What i understood that you would like to move 400 standard primary zones from server 2003 to server 2008 without any manual job.
- simple answer..........
copy all files under DNS folder (c:\windows\system32\dns) on server 2003 and paste those files under same location of server 2008 box.
export registry keys from server 2003 and import registry keys under server 2008.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\DNS\Zones - export zones folder and import on server 2008restart DNS service on server 2008 and you will find all zones appeared automatically.
Cheers.
Friday, May 15, 2009 1:27 PM
+ What i understood that you would like to move 400 standard primary zones from server 2003 to server 2008 without any manual job.
- simple answer..........
copy all files under DNS folder (c:\windows\system32\dns) on server 2003 and paste those files under same location of server 2008 box.
export registry keys from server 2003 and import registry keys under server 2008.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\DNS\Zones - export zones folder and import on server 2008restart DNS service on server 2008 and you will find all zones appeared automatically.
Cheers.
This worked like a charm for me, except for the registry key was actually HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones on my machines. I used this to go from an old 2003 server to a new 2003 server. Have not tried with 2008 yet, so not sure if the key is different there.
-_Dave
Friday, May 22, 2009 9:27 AM
My apologies, it should be DNS servers.
server 2008 stores info on same location, i am sure it will work on server 2008 as well.
Monday, January 18, 2010 11:14 AM | 1 vote
The above info is lacking a step. It will not work unless both keys are imported.
Here are the actual steps.
Credit is due webhostingautomation forums here http://tinyurl.com/dns2003-2008migrate
To move the primary MS DNS server config to a new server, using the existing zone files rather than recreate from Helm:
*
- Stop the DNS Server service on both DNS servers.
- Manually copy the entire contents (subfolders included) of the %SystemRoot%\System32\DNS folder from the source server to the destination server.
- On the current DNS server, start Registry Editor (Regedit.exe).
- Locate and click the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\DNS\Zones
- Export the Zones entry to a registry file.
- Locate and click the following registry subkey: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones
- Export the Zones entry to a registry file.
- On the destination DNS server, double-click each registry file to import the Zonessubkeys into the registry.
- Bring the current DNS server down and transfer its IP address to the destination DNS server.
- On the destination DNS server, start the DNS Server service. To initiate the registration of the server's A and PTR resource records, run the following command at a command prompt:
ipconfig /registerdns*
http://forums.webhostautomation.com/showthread.php?p=183343#post183343
Friday, January 11, 2013 2:41 AM
Y should call Belsin www.belsin.com.br