SQL Server Virtual Lab Section 2

Back to Main page
Back to Section 1

F.Install Windows 2012 Core Base Image

1. Create a new VM as you have done in Step C and run the windows installation again but select Windows 2012 Core (no GUI) this time.
2. Once the installation is done, login with a new password you will create and then shut down the virtual machine.
3. We will use this installation as a Base for our Windows Server Core Installations just as we did in Part E.
4. In Hyper-V Manager right click on that new VM you just created and press Delete.
***We will be doing the exact same thing we did for Part E but with this new Windows Core VM that we just created***
5. OK remember where you stored the Virtual HD you created for the VM? Great… because it has not been deleted and we will use it to create our Windows Core installation.

G. Creating your first Windows 2012 Core machine using a Base Windows 2012 Core Installation

1. In Hyper-V Manager click ACTION > New > Hard Disk
2. Click Next on the First screen and keep the default (VHDX) and click next
3. Select Differencing Disk on the next screen
4. On the next screen name your drive and select the location.
5. On the next screen specify the parent… the Virtual Hard Drive we created fone Windows 2012 Core Installation in Part F.
6. Click Finish then ACTION > New > Virtual Machine
7. Name your VM and select the save location. I would use an easy name to idenify the type of server we are going to create using this particular VM.
Something like Win2012CoreAD (we are going to use this as our Domain Controller when installing Active Directory).
8. Select 512MB for Memory and select your Virtual Switch in the networking section as you did the when you created your first VM.
9. Now for your Hard Disk, select the Differencing Disk you just created. Click Next and Finish.
10. You can verify your hard disk configuration if you like as you did in Steps 10 and 11 of Part E.
11. You now have a Windows Core VM that runs off of a Base installation of Windows Core. You can create more Differencing disks and create more VMs off of that without having to reinstall Windows Core. This is exactly what we did for the Full Windows Installation.

***At this point you should have two functional VMs. One is based on a base installation for Windows 2012 Full and the other one is based on a base installation for Windows 2012 Core.***


H.Create your Active Directory Domain and Domain Controller using your new Windows Core VM Configuration

1. Start up your Windows Core AD server. After computer starts, enter your admin password, at command prompt type PowerShell and press enter.
2. Type sconfig and hit enter. Change computer name by pressing 2 on the menu. Restart once the name has changed. My personal preference is change the computer name to the VM name to keep it consistent.

Networking Setup
1. After the computer restarts, make sure you are logged in and start PowerShell. Type sconfig and hit enter.

2. Pick option 8 for Networking and then select the network interface you want to configure. Description will be something like “Microsoft Hyper-V Network Adapter.”

3. Type 1 to Set Network Adapter Address and press enter.
Type S for static and hit enter. Change your IP address as desired (make a note of the address you pick). Hit enter and then for the next select (Subnet Mask) just hit enter to take the default and the same for Default Gateway.

4. Once the settings are saved, the new changes will be displayed. It make look a little confusing, so type 4 and hit enter to go to the main menu, then
type 8 and hit enter to go back to Network Settings. You will now see your new settings.

5. At the Network Adapter Settings screen, type 2 and hit enter to configure DNS Servers. Type as the prefered DNS and hit enter. Hit enter for
Alternate DNS without typing anything. You should see the results of your change. Exit Sconfig by pressing 4 and hitting enter then pressing 15 and hitting enter.

6. Verify the setting from the PowerShell prompt by typing IPConfig /All and pressing enter or just use the PowerShell Command: Get-NetIPAddress.

Active Directory and DNS Install
1. Install Active Directory
PowerShell Command: Install-windowsfeature -name AD-Domain-Services

2. Create Your Domain
PowerShell Command: Install-ADDSForest –DomainName “SQLLAB.LOCAL” -DomainMode Win2012 -DomainNetbiosName “SQLLAB” -ForestMode Win2012

Replace “SQLLAB.LOCAL” with the domain name you want. I used SQLLAB.LOCAL as my domain (yep cheesy but easy).
Remember to select a complex password for the SafeModeAdministrationPassword or this portion will fail.

3. A prompt will ask you if you want the machine configured as a domain controller press Y and hit enter. After the installation, the computer should automatically restart but if it doesn’t go ahead and restart it using this simple PowerShell Command: restart-computer

4. You now have a new domain with a new domain controller running on Windows 2012 Core.


I. Adding your VM to the domain you created

***Make sure your Windows Core Domain server is running before you attempt this***
1. Start your VM that you installed the full version of Windows 2012 on (SQL2012NodeA in my case). The first thing that should come up when you start your VM is server manager. Minimize this and then go to the Start Menu (just move your mouse down to the lower left corner of the screen). Control Panel should be displayed, if not type out the words, click on the icon.
2. When the control panel comes up, on the right hand there is a drop down labeled “View By” click it and select Large Icons.
3. Click on Network and Sharing Center. On the left side click, Change Adapter Settings. Right click on your Ethernet Adapter and click Properties. On the pop-up click on Internet Protocol Version 4 (TCP/IPv4) and click Properties.
4. Setup Static IPs for your server and make sure you use the same subnet mask as your AD Server and use the AD Server’s IP Address as your Primary DNS. If you cannot remember the IP address or subnet mask, just go to your AD Server and type IPConfig in the command or PowerShell prompt and the information
should be displayed. The screen shot should help out. ***Make sure you use your settings not mine as they may be different***

5. Go back to the control panel and find System and open it. Click on Change Settings. On the Computer Name tab click on Change. Another pop should appear.
Change the name of your computer and then enter the domain. The screen shot should be a good guide for you **Notice I used my VM Name for my computer name, I just like to keep consistency it is in no way a best practice of any sort, or worst practice**

6. Click Ok and enter your Administrator as the user and Domain Admin Password (the one you made when you created your domain).
7. You should get a Welcome message and a request to restart. Restart and Log into the domain. This might not be obvious from the get go, but after pressing CRTL+ALT+Delete you need to click on the arrow pointing left next to the “picture” and select Other User. This screen shot should help you login properly.

Domain Login

J. Create a Windows Core VM for iSCSI

Why you ask? Because you need Shared Storage for your cluster.
1. Create a new VM and use the instructions from Part G so that you can use your Base install of Windows 2012 Core. Make sure you give this new VM a good identifying name like WinCoreiSCSI or something. This should allow you to start your new VM right away.
2. Once your new server loads login. You will need to create a new SID for it before you put it on the Domain. At the command prompt issue the following command to create a new SID for your VM.
Just leave the defaults on the pop-up and press OK. The computer should restart and ask you you enter a new password, you can use your old password if you like.The reason for this is because no two computers should have the same SID and since you used a base image for your install, you are technically using the same SID. It may take a while, but it saves you space (since you are using the same Hard drive for the Base install) and time (since you don’t have to go through another Windows Installation).
4. Once logged in start PowerShell and then run sconfig.
5. Type 2 and press enter to change the computer name. Give it an easy name to remember (whatever you named your VM should be fine). Allow the computer to restart after that.
6. Get back into sconfig and this time change the Domain. Add your server to the domain you created. To do this you need to first setup a Static IP. See Networking Setup in Part H ***Make sure you use the IP Address of the domain controller for your Primary DNS and not***
7. Once this is done, select option 1 in sconfig. Type D and hit enter at the prompt to join a domain.
8. You will be asked to specify the authorized domain\user (SQLLAB\Administrator for example). Type it in and hit enter. Another screen should popup asking for the password, enter it and hit enter. Take note that you cannot see anything being typed so make sure you enter it properly.

Add Windows Core to Domain
9. A new pop-up should appear asking if you want to change the computer name (since we already did there is not need to do this again) Select NO. Select YES when asked to restart.

***At this point you should have the following***
1. VM Running Windows 2012 Core that is a Domain Controller
2. VM Running Windows 2012 Core that is a iSCSI server
3. VM Running Windows 2012 FULL that will have SQL Installed (our First Node for the Cluster)

Continue to Section 3


22 responses to “SQL Server Virtual Lab Section 2

  1. SS

    May 1, 2013 at 11:40 PM

    Tried to join the Windows 2012 Core that is a iSCSI server to the domain and received ‘Fail to join domain’


    • Ayman El-Ghazali

      May 2, 2013 at 7:20 AM

      Make sure your Domain Controller was restarted after you created your domain. Additionally, make sure you type the correct password in. Make sure they are on the same Subnet as well. Let me know if you are still having problems and if you could provide some more info about your setup and maybe some screen shots I will try to help out as much as I can.


      • SS

        May 2, 2013 at 9:36 AM

        I followed all the steps up until the end of section two , which is where I received the error. I created the first VM (SQL2012NodeA) base on a full install. I then created the VM(Win2012CoreAD) base on a core install. I made the core VM(Win2012CoreAD) domain controller. Next, I joined (SQL2012NodeA) to the domain without any problem. I followed all the steps to create the second VM(WinCoreISCSI) but could not join it to the domain. Here is my configuration for the VMs:

        Default Gateway:
        Primary DNS:

        Default Gateway:
        Primary DNS:

        Default Gateway:
        Primary DNS:


  2. Ayman El-Ghazali

    May 2, 2013 at 10:01 AM

    Hmmm that is odd. All of your settings are correct.
    You did SysPrep to get a new SID for the core machine and then did the IP settings right? SysPrep will wipe out all your other settings. So just double check that you did it in that order.
    Also, verify that you have the proper networking setup on the Hyper-V level.

    I’m going to have to sit down and think on this one, it should straight forward especially since you have all the settings correct. I build this lab twice with my instructions to make sure it was 100% correct. I’m really sorry you are having problems but let me give my brain something to do and I’ll get back to you on this one 🙂


  3. SS

    May 2, 2013 at 10:40 AM

    yes, I did the sysprep,it restarted and asked me to change the password.


    • Ayman El-Ghazali

      May 2, 2013 at 10:49 AM

      Can you Ping the AD server from your Core iSCSI Server?


      • SS

        May 2, 2013 at 8:01 PM

        Yes, but not the other way around.


  4. Ayman El-Ghazali

    May 2, 2013 at 8:59 PM

    Are you using the same network switch in Hyper-V for both VMs? This is a real odd ball of a problem. I’m out of ideas at the moment but I’ll try to ask some colleagues. Can you provide an error code for the issue? Also make sure you use your domain admin password correctly,it is tricky because nothing shows up when you type it but just give it another shot.


  5. SS

    May 2, 2013 at 9:07 PM

    network switch is the same. I tried several times and made sure I typed the correct password. I will try to create another VM.


  6. SS

    May 3, 2013 at 12:34 AM

    it looks like the SID does not change after sysprep. I ran sysprep several times and same result. The error says I need to run sysprep to change the SID.


  7. SS

    May 3, 2013 at 12:47 AM

    got it to work! I ran the sysprep but this time I checked the checkbox in the popup that follows the sysprep command. Thanks!


    • Ayman El-Ghazali

      May 3, 2013 at 7:04 AM

      Is it not checked by default? That’s really strange, I’m going to have to try it out sometime. Glad you got it to work. Good luck with Section 3!


  8. SS

    May 3, 2013 at 8:28 PM

    Just completed section 3! Thank you for putting this post together. Great work as usual!


    • Ayman El-Ghazali

      May 4, 2013 at 8:27 AM

      Thanks. Glad I can be of help. It’s only good if it helps you learn and improve your skills.


  9. Raul Santos Neto

    March 5, 2014 at 7:10 PM

    Outstanding article, very useful.. had the same issue as SS (Fail to join domain), also fixed by checking the option “Generalize” after running sysprep.


    • Ayman El-Ghazali

      March 5, 2014 at 7:15 PM

      Thank you very much I’m glad it was useful for you. I put together a video on my YouTube channel about creating SQL VM templates with Hyper-v that you may fins useful if you want a quick stand alone test server.


  10. Victor Barajas

    March 22, 2016 at 12:38 AM

    Hi Ayman. First, thanks for this great post. Quick question, i had the same issue with the domain, but I change the option to Audit Mode and also check the “Generalize” box. Once I did that it worked, my question is: do you know what’s the difference between those options?



    • Ayman El-Ghazali

      March 23, 2016 at 1:50 PM

      I don’t know the difference. I know that generalize does something with resetting the SIDs so that the VMs have different identifiers in the same Active Directory domain so it avoids clashing. Not sure what Audit Mode does to be honest. Hope that helps. I don’t pretend to be an AD expert, it’s too hard 🙂


      • Victor Barajas

        March 23, 2016 at 9:03 PM

        Yeah, you bet! I did not have any idea but I made some research about the difference, in summary we have to use OOBE and check generalize box for the purpose of this lab. If we use audit mode it does not request the password to be changed and when you verify the status of the image is IMAGE_STATE _UNDEPLOYABLE unlike when you use OOBE that after it restarts the machine set the image to IMAGE_STATE_COMPLETE, which seem to be the correct state. Here’s the link with the explanation:

        Thanks again for your effort on put together this post. 🙂


  11. Ayman El-Ghazali

    March 24, 2016 at 7:42 AM

    Thanks for the valuable information!


  12. Rohan

    October 8, 2018 at 11:48 PM

    I did everything as mentioned on post . Even used sysprep and enable generalize option followed by shutdown. Still unable to connect SQL2012NodeA to domain controller failing with below error when changing domain as below

    No luck, please help



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: