Lab environment of Active Directory and Exchange Server

Having a lab environment of your current production environment is very necessary when it comes to make big changes to your infrastructure like migration from older platforms to new ones etc.

In this article, we are going to demonstrate the creation of a lab environment consisting of a domain controller in Windows Server 2008 R2 and an Exchange Server 2010 using Hyper-V host in Windows Server 2012.

In order to accomplish the following steps you would need a separate Hyper-V hosts which will hold the lab environment virtual machines.

As you might know, Hyper-V in Win 2012 has the ability to create replica servers of the running virtual machines. In order to create replica servers, make sure that the destination server has the replication enabled as you can see in replication configuration in the hosts settings as in this figure:

Active Directory DC lab VM creation

Here are the steps needed to make the replica server of the active directory:

  1. On the hyper-v host where the DC is running right click the VM and choose Enable Replication
  2. Click Next on the first window of the wizard
  3. On the Specify Replica Server page, write down the name of the replica server and click Next
  4. On the Specify Connection Parameters choose the Authentication Type the same as those when you enabled replication on the destination host and click Next
  5. On the next step, choose the Virtual Hard Disks to replicate and click Finish.
  6. Wait until the process completes.
  7. After the process have completed, remove the replication of the production DC as in figure as you will not interfere the lab DC with production DC
  8. After removing replication, now you need to create a private virtual switch on the destination Hyper-V host which will be a network communicating only inside the Hyper-V host. You can create this switch by choosing firstly the destination server and the click Virtual Switch manager as in the figure:

  9. On the Virtual Switch Manager window choose Private and then click Create Virtual Switch as in figure:

  10. On the next window choose the name of your virtual switch and click OK.

  11. Now that you have host only virtual switch, you can assign this network to your Lab DC virtual machine by going to VM settings as in this figure:
  12. Now you can start the Lab DC and assign different network address from the production environment. If for example, your production environment has network address with 10.0.0.x, than you should assign either with 172.16.x.x or 192.168.x.x

  13. If you have two or more DC-s in your production environment and you don’t want to make lab VMs for your other DC-s, then you need to remove the replication of DCs in your lab. Pay attention: in LAB, not Production. To do this, you would have to go to Active Directory Sites and Services then go to your Site ->Servers->DC1 (or whatever the name of your server)->NTDS settings and the on the right pane right click <automatically generated> and choose Delete. Then you can delete DC2 and confirming all the warnings. Attention: Please make sure that you are deleting replications on the LAB environment and not production.
  14. If you chose to make the lab only for one DC, then you will have to delete the DNS name servers other than DC1 from DNS console
  15. Restart the server and check whether there is any error in the event viewer

Creating LAB VM of exchange server 2010

To create the lab Virtual machine of exchange server you should follow the same 1-7 steps from above. If your mailbox databases are big and you don’t need the mailboxes you can skip the drives where the Maiboxes databases are (assuming that the mailbox databases are not located on the system drive) from the step 5.

After the process of creating the LAB exchange server, have removed the replication and assigned the hostOnly network, you can start the VM and assign an IP address of the same range as DC.

If you chose to not take the mailbox databases, you can recreate the same databases that will be empty. You just need to have the same drives as in production server. So your databases will be dismounted. Here are the steps:

  1. Open Exchange Management Console and go to Organization Configuration -> Mailbox
  2. On the dismounted mailbox database right click and choose mount database and you will get the following warning:
  3. If you click yes, an empty mailbox database will be created (but make sure that the drive exists as is the case here in my situation: Drive H) and the mailbox database will be mounted. Click Yes.