Solved

dhcp backup restore netsh

Posted on 2014-11-14
26
71 Views
Last Modified: 2015-06-24
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
0
Comment
Question by:jim3725
  • 15
  • 9
26 Comments
 
LVL 35

Expert Comment

by:Mahesh
ID: 40444198
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
 

Author Comment

by:jim3725
ID: 40447050
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
 

Author Comment

by:jim3725
ID: 40447083
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
 
LVL 35

Expert Comment

by:Mahesh
ID: 40447156
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
 

Author Comment

by:jim3725
ID: 40447621
Mahesh, I found the netservices. and deleted the entries. How do I force AD replication ?
I appreciate your explanations, they are very helpfull
0
 

Author Comment

by:jim3725
ID: 40447625
Do I just go to Action and update schema now for AD replication?
0
 
LVL 35

Expert Comment

by:Mahesh
ID: 40447685
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
 

Author Comment

by:jim3725
ID: 40450315
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
 
LVL 35

Expert Comment

by:Mahesh
ID: 40450343
Import will work, you can later authorize DHCP server

DHCP server service get stopped automatically before you import database
0
 

Author Comment

by:jim3725
ID: 40450572
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
 

Author Comment

by:jim3725
ID: 40450608
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
 
LVL 35

Expert Comment

by:Mahesh
ID: 40451656
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:jim3725
ID: 40452283
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
 

Author Comment

by:jim3725
ID: 40452290
Mahesh, I also validated that the spare server is an  authorized DHCP servers in active directory.
thanks again for your help
0
 
LVL 35

Expert Comment

by:Mahesh
ID: 40452417
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
 

Author Comment

by:jim3725
ID: 40452488
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
 
LVL 35

Expert Comment

by:Mahesh
ID: 40452620
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
 

Author Comment

by:jim3725
ID: 40452852
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
 

Author Comment

by:jim3725
ID: 40452877
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
 
LVL 35

Expert Comment

by:Mahesh
ID: 40452980
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
 

Author Comment

by:jim3725
ID: 40453652
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
 
LVL 35

Accepted Solution

by:
Mahesh earned 500 total points
ID: 40454271
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
 

Author Comment

by:jim3725
ID: 40454792
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
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40848398
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 

Author Closing Comment

by:jim3725
ID: 40848399
very helpful throughout the entire process.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Recently, I was asked to look into SCCM 2007 by my employer, having a degree of experience of earlier versions of SMS and some previous SCCM knowledge I didn't expect the procedure to involve to much time. I read a number of guides concerning it…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now