How to Configure a Secondary DNS server(Name Server) in Windows Server 2008

    It is really necessary to have an additional DNS in order to keep the redundancy. If you have configured additional domain controller you may or may not be installed DNS as the part of additional domain creation. If you have not done you need to configure it manually and the below method can help you on this.

    1. Let us consider the scenario that I have a Forward lookup zone named as serverlabs.com in my primary DNS server and I want to create the secondary zone for that.
    1. Make sure that you have installed DNS server role on the server which you want to promote as secondary DNS server.
                             From server manager, select Add role and  on roles select DNS server-> Click Next to continue.


    1. Click Next on Introduction to DNS server and install on confirmation window.




                              Click close on installation succeed window.

    1. Now open DNS server console by Start->Administrative tools->DNS

                             In order to configure secondary DNS server from the DNS console right click on Forward lookup zone                                and select New zone.


    1. Click Next on New zone wizard dialogue box.


    1. On the zone type wizard select the option as Secondary zone since it will help you to configure the zone that is already existing or if you have a backup. Since we have primary DNS we can replicate the details from the server and create secondary server,  Click Next.


    1. Now you need to specify the zone name, specify the zone name that you want to create the secondary zone and click Next.
                             Note: Make sure that the zone name you are specifying here is already existing in your primary DNS                                server, else you will fail to replicate the details on next step.
      

    1. Now on the window master DNS server you need to specify your primary DNS server details. On the section <Click here to add an IP Address or DNS Name> specify your primary DNS server's <IP address > or <hostname> and press ENTER. If the details are correct it will detect automatically the zone details and you can have the labels with green color, click Next.


    1. You can see the summary window and click on Finish to complete it.


    1. Now on secondary server's DNS you can see the created zone details.

    Known issue
    You may complete the steps from 1 to 9 without any issue, but when you locate the newly created zone you may receive the error as listed below.


    Also in the DNS application logs you will have the error reported as


    This is because the zone transfer is not enabled on your primary DNS server. In order to resolve this on your primary DNS server select the zone that you want to create the secondary zone. Right click and select properties(In my case the zone is serverlabs.com).
    Under the tab Zone transfers tick the check box Allow zone transfers and check box To any server. Click Apply and then OK.


    Now on the server where we have failed to replicate details, open DNS console and you will be able to see the DNS details replicated as expected.



How to do Server Metadata Clean Up in Windows server 2008/R2

Understanding the concept

There are many instances that you need to forcefully remove the domain controllers in your network.  If you have performed a successful demotion of the domain controller it will automatically remove the details of that domain controller from AD as well. But during the force removal of DC it will not happen and you need to remove those server details manually from any of your active DC and this process is know as metadata cleanup. This can be done using three methods that are,

  • Metadata cleanup using GUI tools.
  • Metadata cleanup using command line
  • Metadata cleanup using script

  1. Metadata cleanup using GUI tools

This be done in two ways that are using Active directory users and computers and Active directory sites and services. 
Let us consider the scenario that I have tow servers server-1 and server-2 under the domain serverlabs.com. Here my failed domain controller is server-2 and I am removing it from server-1 which is the replication partner of server-2. So on server-1 do the following

  • Using the GUI tool Active directory users and computers

  1. On Start menu, point to Administrative Tools-> Active Directory Users and Computers.
  2. If you have identified replication partners in preparation for this procedure and if you are not connected to a replication partner of the removed domain controller whose metadata you are cleaning up, right-click Active Directory Users and Computers or you <Domain Name> and then click Change Domain Controller. Click the name of the domain controller from which you want to remove the metadata, and then click OK.
  3. Now Expand the domain of the domain controller that was forcibly removed, and then click Domain Controllers.
  4. In the details pane, right-click the computer object of the domain controller whose metadata you want to clean up, and then click Delete.


  1. Now you will have an Active Directory Domain Services dialog box which will ask for confirmation. Click Yes to confirm the computer object deletion.


  1. In the Deleting Domain Controller dialog box select the check box This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO), and then click Delete.


  1. If the domain controller is a global catalog server, in the Delete Domain Controller dialog box click Yes to continue with the deletion.


  1. If the domain controller currently holds one or more operations master roles, click OK to move the role or roles to the domain controller that is shown.
                         Note: You cannot change this domain controller. If you want to move the role to a different domain controller, you                          must move the role after you complete the server metadata cleanup procedure. If you would like to know more                              about moving the roles you can refer the link 

  • Using the GUI tool Active directory sites and services

  1. On Start menu, point to Administrative Tools-> Active Directory Users and Computers.
  2. If you have identified replication partners in preparation for this procedure and if you are not connected to a replication partner of the removed domain controller whose metadata you are cleaning up, right-click Active Directory Users and Computers or you <Domain Name> and then click Change Domain Controller. Click the name of the domain controller from which you want to remove the metadata, and then click OK.
  3. Expand the site of the domain controller that was forcibly removed, expand Servers, expand the name of the domain controller that was forcefully removed and right-click the NTDS Settings object, and then select Delete.


  1. In the Active Directory Domain Services dialog box click Yes to confirm the NTDS Settings deletion.


  1. In the Deleting Domain Controller dialog box tick the check box This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO) and then click Delete.


  1. If the domain controller is a global catalog server, in the Delete Domain Controller dialog box click Yes to continue with the deletion.


  1. If the domain controller currently holds one or more operations master roles, click OK to move the role or roles to the domain controller that is shown.
                         Note: You cannot change this domain controller. If you want to move the role to a different domain controller,                                  you must move the role after you complete the server metadata cleanup procedure. If you would like to know                                  more about moving the roles you can refer the link 
  1. Right-click the domain controller that was forcibly removed and then click Delete.


  1. In the Active Directory Domain Services dialog box, click Yes to confirm the domain controller deletion.


  1. Metadata cleanup using Command line

This can be achieved by using the enhanced version of Ntdsutil.exe. The version of Ntdsutil.exe that is included with Service Pack 1 or later service packs for Windows Server 2003 has been enhanced to make the metadata cleanup process complete. The Ntdsutil.exe version that is included with SP1 or later service packs does the following when metadata cleanup is run:
  • Removes the NTDSA or NTDS Setting subject.
  • Removes inbound AD connection objects that existing destination DCs use to replicate from the source DC being deleted .
  • Removes the computer account .
  • Removes FRS member object.
  • Removes FRS subscriber objects.
  • Tries to seize flexible single operations master roles (also known as flexible single master operations or FSMO) held by the DC that are being removed .

Caution: The administrator must also make sure that replication has occurred since the demotion before manually removing the NTDS Settings object for any server. Using the Ntdsutil utility incorrectly may result in partial or complete loss of Active Directory functionality.

To cleanup using metadata using Ntdsutil use the below steps:

Note: Make sure that you have logged on as a user who is an Enterprise Admin.

Let us consider the scenario that I have tow servers server-1 and server-2 under the domain serverlabs.com. Here my failed domain controller is server-2 and I am removing it from server-1 which is the replication partner of server-2. So on server-1 do the following

  1. Open command prompt, Start->Command prompt->right click and select 'Run as administrator'.
  2. Type 'ntdsutil' ENTER and at the ntdsutil prompt, type the following command
                     'Metadata cleanup' and press ENTER.
  1.  At the Metadata Cleanup prompt type connections and press ENTER.
  2. At the Server Connections prompt, type connect to server server-1
                         where server-1 is the name of an available domain controller which holds Operations Masters Roles.
  1. At the Server Connections prompt, type quit and press ENTER.
  2. Now you will be back to metadata cleanup prompt, type select operation target and press ENTER.
  3. At the Selected  Operations Target prompt, type list domains and press ENTER. This will list all the domains in the forest and each domains listed with a number associated to each.
                         As you can see I have only one domain in my forest that is Serverlabs and its ID is 0.
  1. At the Select Operations Target prompt, type select domain 0, and press ENTER. Where as the number “0” is the domain that contains the failed domain controller(server) .
  2. At the Select Operations Target prompt, type list sites and press ENTER. This lists all the sites in the forest and those are listed with a number assigned to each.
  3. At the Select Operations Target prompt, type select site 0, where number “0” is the site containing the failed domain controller, and press ENTER.
  4. At the Select Operations Target prompt, type list servers in site and press ENTER.
  5. At the Select Operations Target prompt, type select server 1, where number “1” is the failed domain controller, and press ENTER.
  6. At the Select Operations Target prompt, type quit and press ENTER. Please note that by the above steps we have connected to the domain controller that is failed.


  1. In order to start the metadata cleanup At the Metadata Cleanup prompt, type remove selected server and press ENTER.
                         You will have server remove confirmation dialog box, Click Yes to continue.


  1. Now the metadata cleanup will continue and you will have the below result after the successful cleanup.



  1. Type quit twice to exit the command prompt.

  1. Metadata cleanup using Script

                        You can refer the below link in order to achieve the script that will help you to perform metadata cleanup.

How to backup and restore DHCP server in Windows server 2008

On a disaster recovery process you don’t need to manually restore DHCP server details as your System state recovery will recover DHCP server details as well. DHCP servers store DHCP lease and reservation information in database files(MDB file - Microsoft Access Database file). By default, these files are stored in the directory %SystemRoot%\System32\DHCP and this database is backed up every 60 minutes automatically. The DHCP folder may contain below entries,

  • Dhcp.mdb: The primary database file for the DHCP server
  • J50.log: A transaction log file used to recover incomplete transactions in case of a server malfunction
  • J50.chk: A checkpoint file used in truncating the transaction log for the DHCP server
  • Res1.log: A reserved log file for the DHCP server
  • Res2.log: A reserved log file for the DHCP server
  • Tmp.edb: A temporary working file for the DHCP server

Note: Res1.log and Res2.log will be available only if you have any IP addresses reserved.
  

However if you would like to create a manual backup of your DHCP server you can perform this within few steps.

Things to notify before backup

  • To perform this procedure you must be a member of the Administrators group or the DHCP Administrators group on the DHCP server.
  • You must choose a local drive for the DHCP database backup folder.
  • The default backup location for the database backup is %systemroot%\System32\Dhcp\Backup.
  • It is recommended that you back up your DHCP database to a location other than the local drive using Windows Backup (ntbackup.exe) or non-Microsoft backup software.
  • When you store a manually created backup of the DHCP database in the same location as the synchronous backup that the DHCP server creates every 60 minutes, the manual backup is overwritten when automatic backup occurs.

Creating the DHCP backup

1. In the DHCP console, right-click the server you want to back up, and then click Backup. Else select the server that you want to backup and select the tab Actions->Backup
2. In the Browse For Folder dialog box, select the folder that will contain the backup DHCP database, and then click OK.
3.Verify the backup is completed by manually opening the backup location.

Things to notify before restore

  • To perform this procedure you must be a member of the Administrators group or the DHCP Administrators group on the DHCP server.
  • Only a DHCP database backed up from the same Windows Server version can be restored. Restoring a DHCP database from a different Windows server version is not supported. To migrate a DHCP database from one Windows Server version to another, use the netsh export/import command.
  • Only DHCP databases from the same language version can be restored. For example, a DHCP database from DHCP server running an English language version of the operating system cannot be restored to a DHCP server running a Chineselanguage version of the operating system.
  • To restore the DHCP database, the DHCP service is temporarily stopped. When it is stopped, DHCP clients are unable to contact the DHCP server and obtain IP addresses. 

Restoring the DHCP server from backup

1. In case of disaster recovery you may need to get the copy of the DHCP server backup from System state backup.   In this case get a good copy of the %SystemRoot%\System32\DHCP\Backup directory from the system state backup. If you have a DHCP server backup on another server or disk copy this to servers local disk and proceed as below.
2. Start the DHCP console, right-click the server you want to restore, and then click Restore.
3. In the Browse For Folder dialog box-> select the folder that contains the backup you want to restore and then      click OK.
4.As notified above it will ask to stop the DHCP service temporarily, click Yes to continue.



5.You will have the below screens when these actions takes place.




6.Once it is restored you will have the success message.


7.If there is an issue while restoring you will have the below window and to troubleshoot review your system logs.


Additional information

Manually backup and restoration of DHCP server can be done using command line as well. Netsh will help you to do it. Follow these steps if you would like to;

Backup using command prompt

1.Open command prompt as Administrator(Right click and select Run as administrator(You must a member of administrator or DHCP administrators to perform this)).
2.Type 'netsh' ENTER-> Now in order to connect to DHCP service type 'dhcp' ENTER.
3.Now specify the DHCP server, you need to type 'server  <\\dhcp server name>' ENTER(In my network server name is 'server-1')
4.You are now connected with the DHCP server and in order to perform a backup type 'backup <directory to save the backup>' ENTER(For me it is 'backup c:\dhcp'). Once it is completed you will have a success message.


The above backup operation can be done in a single step as well. In command prompt type,
Netsh dhcp server <\\yourDHCPservername> backup <directory to save the backup> ENTER.
For me it will be : 
netsh dhcp server \\server-1 backup c:\dhcp


Restore using command prompt

1.Open command prompt as Administrator(Right click and select Run as administrator(You must a member of administrator or DHCP administrators to perform this)).
2.Type 'netsh' ENTER-> Now in order to connect to DHCP service type 'dhcp' ENTER.
3.Now specify the DHCP server, you need to type 'server  \\dhcp server name' ENTER(In my network server name is 'server-1')
4.You are now connected with the DHCP server and in order to restore type 'restore  <directory where the DHCP backup is available>' ENTER(I have saved my backup in 'c:\dhcp'). Once it is completed you will have a success message.


In order to restore DHCP in a single step type the below command:
netsh dhcp server <\\YourDHCPserver> restore <backup location>ENTER
For me it will be:
netsh dhcp server \\server-1 restore c:\dhcp



If you would like to know more about the operations that can be performed with netsh, type 'help' or '?' which will list out all the available commands.

How to rectify Journal wrap errors, Event id 13568 sournce NtFrs

Understanding Journal wrapper

Journal wrap errors occur if a sufficient number of changes that occur while FRS is turned off in such a way that the last USN(Update sequence number counter) change that FRS recorded during shutdown no longer exists in the USN journal during startup. The risk is that changes to files and folders for FRS(File replication service) replicated trees may have occurred while the service was turned off, and no record of the change exists in the USN journal. To guard against data inconsistency, FRS asserts into a journal wrap state. Let me simplify the statement, FRS has an internal database that contains all the files and folders it is replicating and each of these has a unique global ID (GUID).  The database also contains a pointer to the last NTFS disk operation (in the USN Journal/NTFS Journal) that the FRS service processed.
If a user changes a file or folder on a disk, the following happens:
  1. the operation is picked up by NTFS and an entry is made in the NTFS Journal
  1. FRS monitors the NTFS Journal for changes and notes that a change has been made to that file
  1. FRS keeps a record of the last NTFS Journal event that it processed and checks if it has processed it already
  1. If it hasn’t processed it already, it looks at whether it is a file that it should replicate
  1. If it should be replicated, the file goes into the normal process of staging, replicating, etc.
  2. FRS increments the entry in its database about the NTFS Journal event that it has processed so it won’t consider it again

If there is a situation that the replication files has got few changes and the DC's doesn't communicate with each other because replications partners was shutdown for a long time, FRS was not running or because of a communication failure in the network. When the communication is reestablished, FRS still knows the last NTFS Journal entry that it processed and it will compare this with the current NTFS Journal the next time it restarts.
The next time the FRS service starts, it sees that it has missed NTFS operations on the disk(It compares the its last processed NTFS operation and current NTFS journal database). This is when FRS complains it has reached a Journal Wrap state, the NTFS Journal log has wrapped around and it doesn’t know the current state of things on the disk.

Identifying the replication errors

1)As discussed above when there is a replication failure you will see the journal wrapper errors in the event logs.
  

2)There is one more method which you can confirm the replication is failed by using the native windows component 'replmon'. In order to check this follow these steps,(Remember that you do not have 'replmon' in Windows server 2008. However you can install it by following the link 


  1. Start->Run->type 'replmon' ENTER, This will open the replication monitor window.
  1. Now add the servers one by one to observe the status of replication. Once it is added right click on each server and select the option 'show group policy object status'.
  1. It will show you a windows that indicates the status of GPO replication for the particular server.
  1. Here you can find out the servers that has the good SysVol and corrupted as well. When the replication is success on a server it will have a blank 'Synch Status' Column, in addition the 'Version' and 'SysVol Version' columns will have identical numerical values.


  1. When there are issues in replication you may find the group policy object status as below.


In my case I have three GPOs that are failed to replicate to second server(Serer-2). Namely that are 'Clients', 'serverlabs test' and 'new group policy object'.  A good copy of sysvol will have a blank 'Synch Status' Column, in addition the 'Version and 'SysVol Version' columns will have identical numerical values. Here on the corrupted policies you can see the Synch status with a cross mark and its Version and SysVol versions are different or ERROR.

Restoring FRS replicas

Please make sure that you have a full backup of all your domain controllers before continuing with this process, this will help us to restore from backup if we do not have a good copy of SysVol in any of the servers. Generally there are two methods which you can consider to resolve the replication errors.
  1. Non-authoritative mode restore
  2. Authoritative mode restore

Let us consider these one by one.

Non-authoritative mode restore
This method is used when individual members of FRS replica sets that are having difficulty like assertions in the FRS service, corruption of the local jet database, journal wrap errors  or FRS replication failures. It is recommended to perform a non-authoritative restore before you consider the authoritative restore. Note: Performing the below steps will reinitiate the replication again from its replication partner. So make sure that the replication partner of affected server has a good copy of SysVol. Perform the below step on the server which is affected with replication issues.

  • Click Start, and then click Run.
  • In the Open box, type cmd and then press ENTER.
  • In the Command box, type 'net stop ntfrs'.


  • Click Start, and then click Run.
  • In the Open box, type regedit and then press ENTER.
  • Locate the directory 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NtFrs\Parameters\Backup/Restore\Process at Startup'.
  • In the right pane, double-click 'BurFlags'.
  • In the Edit DWORD Value dialog box, type D2 and then click OK.


  • Quit Registry Editor, and then switch to the Command box, type net start ntfrs and close it.


              The above steps performs the below actions.

  • The value for BurFlags registry key returns to 0.
  • An event 13565 is logged to signal that a nonauthoritative restore is started.
  • The FRS database is rebuilt.
  • The member performs an initial join of the replica set from an upstream partner or from the computer that is specified in the Replica Set Parent registry key if a parent has been specified for SYSVOL replica sets.
  • The reinitialized computer runs a full replication of the affected replica sets when the relevant replication schedule begins.
  • When the process is complete, an event 13516 is logged to signal that FRS is operational. If the event is not logged, there is a problem with the FRS configuration.

Authoritative FRS restore

This is recommended on if the above steps does not resolve the issue. The following list of requirements must be met when before you perform an authoritative FRS restore:
  • The FRS service must be disabled on all downstream partners (direct and transitive) for the reinitialized replica sets before you restart the FRS service when the authoritative restore has been configured to occur. So on all affected server and stop FRS service by following the steps:
                       Open command prompt and type 'net stop ntfrs' which will stop the services.
  • Events 13553 and 13516 have been logged in the FRS event log. These events indicate that the membership to the replica set has been established on the computer that is configured for the authoritative restore.
  • The computer that is configured for the authoritative restore is configured to be authoritative for all the data that you want to replicate to replica set members.

Perform these steps to start authoritative restore on the server which has good copy of SysVol

  • Click Start, and then click Run.
  • In the Open box, type cmd and then press ENTER.
  • In the Command box, type 'net stop ntfrs'.


  • Click Start, and then click Run.
  • In the Open box, type regedit and then press ENTER.
  • Locate the directory 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NtFrs\Parameters\Backup/Restore\Process at Startup'.
  • In the right pane, double-click 'BurFlags'.
  • In the Edit DWORD Value dialog box, type D4 and then click OK.



  • Quit Registry Editor, and then switch to the Command box, type net start ntfrs and close it.


  • Start the FRS service on all other servers that where having bad copies of SysVol and it will start replication.

              Performing the above will make changes as listed below:

  • The value for the BurFlags registry key is set back to 0.
  • An event 13566 is logged to signal that an authoritative restore is started.
  • Files in the reinitialized FRS replicated directories remain unchanged and become authoritative on direct replication. Additionally, the files become indirect replication partners through transitive replication.
  • The FRS database is rebuilt based on current file inventory.
  • When the process is complete, an event 13516 is logged to signal that FRS is operational. If the event is not logged, there is a problem with the FRS configuration.

             Now add the servers to replication monitor and make sure that there is no replication issues.
             Below article will help you with troubleshooting Journal wrap errors