dhcp backup restore netsh

A couple of things. I did a netsh dhcp show server and 4 servers were found in the directory services.
Only one server is the dhcp server, the other 3 do not exist any longer. their Directory service Ds location: cn=192.168.1.12 , etc. How do I remove those 3 bad entries?
Also I did a copy bat file in task scheduler to copy the contents from c:\windows\system32\dhcp\backup to another DC server to a mapped Z drive. This will run everyday at 6pm.
What is the process for restoring this dhcp db if my primary dhcp server fails.
both servers are virtual enterprise windows 2008 sp2 servers
jim3725Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaheshArchitectCommented:
Logon to root Domain DC as member of domain admins \ enterprise admins ID and load configuration partition in Adsiedit.msc tool
The tool is available under Start\administrative tools
Then navigate to Configuration\services\Net Services
There you will find all authorized DHCP servers in active directory, just delete unwanted server from there and force AD replication
At same place above you will find DHCPRoot, go to its properties and navigate to DHCPServers attribute, double click it and ensure that there are no stale DHCP server entry left, if found, just delete it as well.
Again force AD replication.
This will remove unwanted DHCP servers from AD
http://blogs.technet.com/b/networking/archive/2009/02/27/old-dhcp-servers-appear-in-the-list-of-authorized-servers-after-a-domain-rename.aspx

The process of exporting DHCP scope from one server and importing it on another server is pretty straight forward. User netsh command for that, Check below article for step by step
http://support.microsoft.com/kb/281626
http://blogs.technet.com/b/canitpro/archive/2013/04/29/step-by-step-migration-of-dhcp-from-windows-server-2003-to-windows-server-2012.aspx

Mahesh
0
jim3725Author Commented:
Mahesh,  I launched the adsiedit and i only see the default naming conxted for my domain , plus the CN= computers, CN=Bulletin, CN=Domain Controllers. I don't see where to  navigate to Configuration\services\Net Services
This is great info, but I need alittle more help.
0
jim3725Author Commented:
Also, I am not able to located the export command within my DC1 server, so I can do the export
The following command exports the full service configuration to the c:\Temp\Dhcpdb file:
export c:\temp\dhcpdb all
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

MaheshArchitectCommented:
In adsiedit.msc right click adsiedit and click connect to
Under "Select well known naming context" radio button, from drop down list, select Configuration and click OK

For export and import, you need to 1st get into netsh prompt

Open elevated command prompt on DHCP server
Then type Netsh and hit enter
Then type Dhcp server \\DHCPServerName - logged on server
Then type export c:\temp\dhcpdb all
This will backup \ export DHCP server database.

Copy this DHCP server backup folder to new DHCP server where you want to restore Database
Now from elevated command prompt run Netsh and hit enter
Then type Dhcp server \\DHCPServerName - logged on server
Then type import c:\temp\dhcpdb all
This will restore \ import DHCP server database to new server

The both links shown in earlier already mentioned all these steps, you forgot to run netsh from elevated command prompt
0
jim3725Author Commented:
Mahesh, I found the netservices. and deleted the entries. How do I force AD replication ?
I appreciate your explanations, they are very helpfull
0
jim3725Author Commented:
Do I just go to Action and update schema now for AD replication?
0
MaheshArchitectCommented:
Logon to domain controller
From elevated command prompt run repadmin /syncall command
This command will force D replication
U may run this command on every domain controller OR AD replication will automatically takes place after 3 HRS
0
jim3725Author Commented:
quick question: If on my other server that I would run the import command on, If the server does not have dhcp server activated, cause I don't want to activate , but will the import command work, if dhcp is not active?
Just wanted to ask.
0
MaheshArchitectCommented:
Import will work, you can later authorize DHCP server

DHCP server service get stopped automatically before you import database
0
jim3725Author Commented:
Mahesh, I added the dhcp server role on to my other dc.
I rebooted server. I am not able to unauthorize it when the service is started.  It's says parameter is incorrect when I try to unauthorize it. I currently have dhcp server service disabled. Not sure if if can do the import they way it stands now.
I'm hesitant on enabling this, I haven't added any scope parameters.  My goal was to have a 2nd dhcp ready incase their my primary dhcp server failed.
0
jim3725Author Commented:
I got the following error message then trying to do import see attatchment.
Option 6 is dns entry, and 192.168.4.4 is the server that I 'm trying the import on.
0
MaheshArchitectCommented:
If its already authorized, no need to unauthorized it.

The error message is came because existing DNS entry is got created under DHCP server options during your initial DHCP installation \ setup

Start the DHCP server service for time being and Go to server options on DHCP server snap-ins and remove the option 6 dns option

Then restore DHCP database (Import with Netsh) and check if everything is restored correctly, then stop and disable DHCP service and let me know if it works.
0
jim3725Author Commented:
mahesh, This worked sucessfully. Is it best to just do a manual export and import weekly to keep a current copy on the spare dhcp server?
0
jim3725Author Commented:
Mahesh, I also validated that the spare server is an  authorized DHCP servers in active directory.
thanks again for your help
0
MaheshArchitectCommented:
No need to import every week on spare DHCP server to make it current.

All you need to do is, just set some thing like .bat file to backup DHCP DB from Netsh export command and make it schedule task on primary server on daily or weekly basis.

Any time you wanted to bring spare server online, just ensure that this server goes offline and start dhcp service on spare server and import DHCP from backup above

Ex bat file

Netsh
Dhcp server \\DHCPServerName
export c:\temp\dhcpdb all

If you created this type of .bat script, its output will get overwritten every time by new output and you will get latest backup copy if required.

As additional measure you can backup this already backed up DB to another location if required
0
jim3725Author Commented:
Mahesh, I tried this as a bat file, and It didn't overwrite it, Can you take a look at it.
the task history says task dhcp-export sucessfully completed cation "c:\windows\system32\cmd.exe" with return code 1.
I didn't see the date change on the c:\temp\dhcpdb file
C--download-dhcpcopy.txt
0
MaheshArchitectCommented:
I think its refusing to overwrite

You can rename old dhcp db and check if new file gets created

In that case you can delete old file after backing it to else location
also copy command should be
copy c:\temp\* z:\
0
jim3725Author Commented:
When I run this from command line, it works fine for exporting, it takes about 5-10 sec.
When I use the batch file it doesn't seem to wait long enough before it goes on to the next command for copying, so the dhcpdb file in c:\temp isn't created yet.
0
jim3725Author Commented:
How do I get out of the command when the export is finished, I am still in the netsh > prompt.
I've tried quit or exit but that doesn't work.
0
MaheshArchitectCommented:
OK

By default, Windows Server automatically backs up the DHCP database files and registry configuration every 60 minutes and saves the backed up information in the \System32\DHCP\Backup folder

try below command to backup dhcp through netsh instead of export
This can be imported through netsh if wanted to

netsh dhcp server \\servername backup destdir
Ex:
netsh dhcp server backup C:\Backups\DHCP

If you didn't mention dhcp server name \ IP, it will assume local server
This will back up DHCP registry configuration and DHCP database file (.mdb format) to the destinated folder.
0
jim3725Author Commented:
This works better in the batch file. Do I do a restore on the spare server, what's the command to replace the import side since it's a mdb file ?
0
MaheshArchitectCommented:
I have not tested, but you should be able to restore dhcp backup with netsh import command, you need to provide import path with .mdb extension.
Please test it.

Sorry to say, but I haven't played with DHCP backup and restore much.
I always used to backup %systemroot%\dhcp\backup folder
My dhcp server is installed on DC, as a fact it is getting backed up automatically with System State backup.
In case if wanted to restore I use method mentioned in below article
http://technet.microsoft.com/en-us/magazine/ff621490.aspx

Only above method don't work correctly if DHCP server OS are different, (Ex: source 2003 and destination 2008), that is why I suggested you netsh method.
http://support.microsoft.com/kb/962355
Only thing I note down dhcp reservations in additions to above method, so in case even if I failed to restore DHCP, I can manually create scopes as required and later on create reservations.
One might don't like this as he might have 100's of DHCP scopes
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jim3725Author Commented:
Thanks Mahesh for assisting me. I do a BMR on these two windows 2008 servers, so i could restore these files from that source if needed. I will try the netsh with mdb extension and see how it works, along with documenting the scope.
0
Seth SimmonsSr. Systems AdministratorCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
jim3725Author Commented:
very helpful throughout the entire process.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.