Repare a DHCP Scope Corrupted Database

This shows up when a DHCP scope has a blue exclamation mark next to it in the MMC, and when the “MMC snap-in failed to initialize” when you click on address leases.
·          Try to backup database, and recover it
·          If that fails, recreate the DHCP scope using the settings in Restore file (editing the values first)


C:\Windows\system32>cd\

C:\>netsh dhcp server export C:\dhcp.txt all

Command completed successfully.

C:\>netsh dhcp server dump >dhcpdump.txt

C:\>start .

C:\>cd Windows

C:\Windows>cd System32

C:\Windows\System32>cd dhcp

C:\Windows\System32\dhcp>net stop dhcpserver
The DHCP Server service is stopping.
The DHCP Server service was stopped successfully.


C:\Windows\System32\dhcp>jetpack.exe dhcp.mdb temp.mdb

C:\Windows\System32\dhcp>net start dhcpserver
The DHCP Server service is starting...
The DHCP Server service was started successfully.


C:\Windows\System32\dhcp>net stop dhcpserver
The DHCP Server service is stopping.
The DHCP Server service was stopped successfully.


C:\Windows\System32\dhcp>esentutl /p C:\windows\system32\dhcp\dhcp.mdb /t C:\win
dows\system32\dhcp\tmp.mdb

Extensible Storage Engine Utilities for Microsoft(R) Windows(R)
Version 6.1
Copyright (C) Microsoft Corporation. All Rights Reserved.

Initiating REPAIR mode...
        Database: C:\windows\system32\dhcp\dhcp.mdb
  Temp. Database: C:\windows\system32\dhcp\tmp.mdb

Checking database integrity.

                     Scanning Status (% complete)

          0    10   20   30   40   50   60   70   80   90  100
          |----|----|----|----|----|----|----|----|----|----|
          ...................................................


Integrity check successful.

Note:
  It is recommended that you immediately perform a full backup
  of this database. If you restore a backup made before the
  repair, the database will be rolled back to the state
  it was in at the time of that backup.

Operation completed successfully in 5.975 seconds.


C:\Windows\System32\dhcp>net start dhcpserver
The DHCP Server service is starting...
The DHCP Server service was started successfully.


C:\Windows\System32\dhcp>cd\

C:\>cd temp

C:\temp>netsh dhcp server v4 export 10.1.110.0

To export service V4 configuration of the local server to a file.

Syntax:

        export <Filename> <ScopeList|filter|all>

Parameters:

        FileName       - File where the configuration will be stored.

        ScopeList      - List of subnet IP addresses (separated by spaces)
                         of all the scopes that need to be exported.
                         If only filter records need to be exported, the
                         string "filter" can be specified. If all the
                         scopes and filter records need to be exported,
                         the string "all" can be specified.

Notes:         This command works only on the local server.
               The command takes a long time to execute if the
               service has a large number of scopes or large number of
               clients, etc. The DHCP server service is stopped, when this
               command is running.

Example:       export c:\temp\dhcpdb all

               This command exports the full service configuration to
               the file c:\temp\dhcpdb.

               export c:\temp\dhcpdb 10.0.0.0 20.0.0.0

               This command exports the configuration pertaining to
               scopes 10.0.0.0 and 20.0.0.0 to the file c:\temp\dhcpdb.

               export c:\temp\dhcpdb filter

               This command exports the configuration pertaining to
               filters to file c:\temp\dhcpdb.
Error 87 in FormatMessageW()

Parameter(s) passed are either incomplete or invalid.

C:\temp>netsh dhcp server v4 export C:\temp 10.1.110.0
Access is denied.


C:\temp>netsh exec restorefile.txt

Command completed successfully.

Changed the current scope context to 10.1.110.0 scope.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.

Command completed successfully.



C:\temp>

Restorefile.txt - Example

dhcp server \\AD01.contoso.com add scope 10.1.110.0 255.255.255.0 "VLAN110" "Data VLAN"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set state 1
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set delayoffer 0
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add iprange 10.1.110.21 10.1.110.249 
dhcp server \\AD01.contoso.com scope 10.1.110.0 set napstate Off
dhcp server \\AD01.contoso.com Scope 10.1.110.0 add excluderange 10.1.110.248 10.1.110.248
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 51 DWORD "86400" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 3 IPADDRESS "10.1.110.1" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 15 STRING "contoso.com" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 6 IPADDRESS "10.1.140.11" "10.2.71.50" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 67 STRING "smsboot\x64\wdsnbp.com" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 242 STRING "MCIPADD=10.1.80.9,10.1.120.2,L2Q=1,L2QVLAN=120" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 176 STRING "MCIPADD=10.1.80.9,10.1.120.2,L2Q=1,L2QVLAN=120" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 set optionvalue 66 STRING "10.1.140.48" 
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.23 68b59941da86 "NPI41DA86.contoso.com" "HP LaserJet P3015" "DHCP"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.52 008087b447cd "OKI-C9600SS-B447CD.contoso.com" "OKI C9600" "DHCP"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.240 00204ac658ee "tempgaurd.travelleader.com" "tempgaurd.contoso.com" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.205 001eec2e477e "cso-dc5kbase." "Tom DeMeulenaere's laptop" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.239 002319001e6c "SecurityPanel" "SecurityPanel" "DHCP"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.238 00066722b6c9 "UPS1" "UPS1" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.42 00163560c132 "WHQTG0232.contoso.com" "Mark Preuss workstation" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.9 b4b52ff46f1e "NPIF46F1E.contoso.com" "HP LaserJet 600 M601" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.17 2c9efc1baa3d "Canon1BAA3D.contoso.com" "RICOH Aficio MP 9000 PCL 5e" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.19 001e8fd31d1e "CanonD31D1E.contoso.com" "RICOH Aficio MP 4000 PCL 5e" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.5 2c59e575e21c "NPI75E21C.contoso.com" "HP LaserJet 4250 PCL 5e" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.6 2c44fd06fddc "NPI06FDDC.contoso.com" "HP LaserJet M401N" "BOTH"
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Add reservedip 10.1.110.7 0001e63593d6 "NPI3593D6.contoso.com" "HP LaserJet 4100 Legal Dept" "BOTH"
dhcp server \\AD01.contoso.com v4 Scope 10.1.110.0 Set NameProtection enable= 0
dhcp server \\AD01.contoso.com Scope 10.1.110.0 Set DnsConfig 1 1 1 1
Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

0 comments:

Post a Comment