How to create your Windows Server 2012 R2 Hyper-V Lab using Server Manager and Windows PowerShell.

This Hyper-V lab should be suitable for the MCSA: Windows Server 2012 courses, M20410, M20411 and M20412, as well as for learning/testing multiple technologies in Windows Server 2012 R2.

Disclaimer: While all the steps here have been tested to work, some additional troubleshooting and tweaking may be necessary. The information here is given in good faith.

Hardware:The following physical hardware is recommended as a minimum. Any less than this will require you to adjust the virtual machine specifications down:



STEP 1: Get your filthy mitts off my ISOs and get your own…!

Download Windows Server 2012 R2 Datacenter Evaluation or Windows Server 2016 Evaluation.

  1. Open your favourite browser and in your favourite search engine, search for intitle:Try Windows Server 2012 R2 or intitle: Windows Server 2016 Evaluation.
  2. Select the option from TechNet Evaluation Center - Microsoft. Make sure to select the Windows Server 2012 R2 option (Not the Windows Server 2012) or Windows Server 2016 Evaluation and register to get the link, then download and save the Windows Server 2012 R2 or Windows Server 2016 Datacenter 64-bit ISO locally (We’ll assume C:\ISO\WS2012R2EntEval.ISO or C:\ISO\WS2016EntEval.ISO).
  3. Download Windows 10 Enterprise Evaluation

  4. As it is becoming more and more difficult to download Windows 8.1, from the same link as above, at the top of the page, select the Evaluate Now button and in the drop-down, select Windows 10 Enterprise.
  5. Jump through the relevant hoops and save the ISO locally (We’ll assume C:\ISO\W10EntEval.ISO).

  Skip the next several pages and go straight to the PowerShell code...

STEP 2: Get your Networking on…

Create some Layer 2 switches for the Virtual Machines to connect to using the Hyper-V Virtual Switch Manager.

  1. Click on START and type Hyper-V. Right-click on Hyper-V Manager and select Pin to Start, right-click on Hyper-V Manager again and select Pin to Taskbar.
  2. Now open Hyper-V Manager. Click on Virtual Switch Manager.
  3. With New virtual network switch selected, under Create virtual switch and What type of virtual switch do you want to create? Select Private and beneath that, click on Create Virtual Switch.
  4. Name the virtual switch Private Network and under Connection type and What do you want to connect this virtual network to? make sure that Private Network is selected.
  5. Repeat steps 3 and 4, naming the second virtual switch Private Network 2.


STEP 3: Virtual Machine creation…

Now let’s create some Virtual Machines (VMs). The following virtual machines will need to be created;

You may need to adjust the specifications to meet your own individual resources and requirements.

  1. In Hyper-V Manager, on the Actions pane on the right-hand side, click on New and select Virtual Machine.

  2. Click Next on the Before You Begin screen and on the Specify Name and Location screen, type LON-DC1 as the name of the virtual machine (VM).
  3. Enable the checkbox next to Store the virtual machine in a different location and select a suitable location; this will typically be a fast drive (SSDs are recommended), with enough space and can be backed up easily. Click Next.
  4. On the Specify Generation screen, leave Generation1 selected as default and click Next.
  5. On the Assign Memory screen, type in 2048 and make sure that the Use Dynamic Memory for this virtual machine. checkbox is selected. Click Next.
  6. On the Configure Networking screen, select Private Network from the Connection drop-down box and click Next. THIS IS NIC 1!
  7. On the Connect Virtual Hard Disk screen, leave the Name and Location as default, change the size to 30GB (or higher, if you can afford it, or as per specifications above). Click Next.
  8. On the Installation Options screen, select the Install and operating system from a bootable CD/DVD-ROM option and select the Image file (.iso) radio button and Browse to the location of the Windows Server (2012 or 2016) ISO. Click Next. Review the Summary, and click Finish.
  9. Repeat the steps for all VMs, making the changes necessary according to the specifications above, before starting any of the VMs.
  10. Once all the VMs have been created, click once on the LON-DC1 VM, click on Settings in the Actions pane, and make the following changes (depending on your computer specification, some may not be possible);
    1. Under Add Hardware, select Network Adapter, click Add and on the Network Adapter pane, under Virtual switch, select Private Network 2 from the drop-down box.
      (NOTE! You will have repeat this step (10.a) for LON-SVR1 and LON-SVR2. These NICs will later be renamed to "1.Internal" and "2.External".) THIS IS NIC 2!
    2. Under the Memory section, change the RAM and Dynamic Memory settings as per the specifications above.
    3. Change the Number of virtual processors: 4
  11. Select and copy the text of the location of the existing hard disk up to the Virtual Machines text, thus; G:\HVVM\LON-DC1\VirtualHard Disks\
  12. For LON-DC1, LON-SVR1 and LON-SVR2 VMs, add a second, 10GB HDD to IDE Controller 0.
    1. In the Settings page of each VM (these can be selected using the green left/right arrows on the top bar or via the drop-down bar that bears the VM name), click on IDE Controller 0, and on the right-hand pane, make sure Hard Drive is selected and click on Add.
    2. In the new Hard Drive window, under Virtual Hard Disk, click on New.
    3. Click Next on the Before You Begin screen. Click Next.
    4. Make sure VHDX is selected in the Choose Disk Format screen. Click Next.
    5. In the Choose Disk Size screen, select Fixed size. Click Next.
    6. In the Specify Name and Location screen, next to Name: type in LON-DC1-Allfiles.vhdx and next to Location: paste the location that you copied in step 11, or locate the location of the existing hard disk (e.g., G:\HVVM\LON-DC1\Virtual Hard Disks\LON-DC1.vhdx) and copy the text up to the trailing backslash after Virtual Disks (e.g., G:\HVVM\LON-DC1\Virtual Hard Disks\).
    7. Download the following three files:        SHA256: 6cda1105ea2619711054d640b7c065feadee7c2c347597e62cd05480989a3dea     SHA256: 5ef5efaf962afa2fac740de31b8dadf43b69dfd27111b4d86d9fa1d304be7b2d     SHA256: afd3671b49c1d8bf9470bdaf966401a0cc61112f2a494cd245d27da8e1d0391f

      Copy the contents of to the LON-DC1 second hard disk, to the LON-SVR1 second hard disk and to the LON-SVR2 second hard disk.

STEP 4: Virtual Machine Installation…

Now we can start installing OSes and configuring the Virtual Machines.

  1. Right-click the LON-DC1 virtual machine in the center pane and select Connect, or highlight the VM and in the Actions pane, click on Connect.
  2. On the menu bar, click on Media, expand DVD Drive and select Insert Disk… Browse to the relevant ISO, click on it and then click on Start inside the VM. Windows installation should start.
  3. For Language to install: Select any language, as long as it’s English (United States), however, for Time and Currency format: select English (United Kingdom).
  4. Click Next, then on the next screen, Install Now.
  5. In the Select the operating system to install window, make sure to select Windows Server 2012 R2 Datacenter Evaluation (Server with a GUI).
  6. Continue with LON-DC1 installation.
  7. If you wish, you may now start installing the other VMs, but note that multiple, simultaneous installations will undoubtedly, negatively impact host computer resources, especially where they are limited.

  8. Once the installation completes, the VM will restart and you may now repeat step 2 above and select Eject.
  9. Upon restart use the credentials below and click on Finish.
  10. Username:    Administrator
    Password:     Pa$$w0rd

STEP 5: Windows Server Virtual Machine Configuration…

First things, first. We’ll perform post-installation configuration and the install some key roles.

  1. Log onto LON-DC1 using the username; Administrator and the password; Pa$$w0rd.
    Once logged in, when Server Manager opens, click on Configure this local server and then click on the randomly generated computer name (e.g. WIN-EMQF28R2OCP).
  2. The System Properties dialog screen open. Under Computer Name, in the Computer description: field, type in LON-DC1 and then below that, click on Change...
  3. In the Computer name: field, type in LON-DC1 and then click on OK.
  4. Click OK in the Computer Name/Domain Changes popup dialog. Click Close in the System Properties window. When the restart popup appears, select Restart Later.
  5. Back in Server Manager, click on Configure this local server and click on the IPv4 address assigned by DHCP, IPv6 enabled link next to Ethernet.
  6. Right-click the first Ethernet NIC, select Rename and rename it to 1.Internal. Right-click the second NIC, and rename it to 2.External.
    (NOTE! You will have repeat this step (6) for LON-SVR1 and LON-SVR2.
  7. Right-click the 1.Internal NIC, select Properties, then Internet Protocol Version 4 (TCP/IPv4).
  8. Enter the appropriate IP settings. Take special note of DNS settings.

    The 1.Internal NICs on LON-DC1, LON-SVR1 and LON-SVR2 will have the following IP settings:

    DNS2: Blank Blank

  10. The 2.External NICs on LON-DC1, LON-SVR1 and LON-SVR2 will have the following IP settings (All other entries may be left blank.):

  12. Click OK then Close.
    NOW, go back to the 1.Internal NIC and check those DNS settings I told you about... Once ales ist gut, Click OK then Close.

    HINT! To identify which NIC is connected to the (Internal) “Private Network”, in Hyper-V Manager, select the LON-DC1 VM, click on Settings and click on one of Network Adapter and under Virtual switch choose Not connected. The corresponding NIC in the VM should respond with Network cable unplugged.

  13. Now restart the VM.
  14. Once restarted, go back into the NIC settings and verify that the DNS settings have not changed.

STEP 6: Promote the Server to a Domain Controller…

Now we'll go ahead and complete the promotion of LON-DC1 to a domain controller.

  1. In Server Manager, the notification icon should be showing a red flag. One of the notifications should be a link to Promote this server to a domain controller. Click on this link.
  2. The Active Directory Domain Services Configuration Wizard opens.
  3. Select Add a new forest and type for the Root domain name: Click Next.
  4. In the Domain Controller Options screen, type Pa$$w0rd as the Domain Services Restore Mode (DSRM) password.
  5. Click Next to ignore the warning in the DNS Options screen.
  6. Click Next all the way to the end and start the installation, after making sure that All prerequisite checks passed successfully.
  7. Once the DC has been installed, Configure DNS
    1. Click on Tools and open the DNS Manager.
    2. Expand Forward Lookup Zones, right-click on, and create the following resource records;
      Record Value Record Type
      adfs172.16.0.10 Host (A)
      crl Alias (CNAME)
      EnterpriseRegistration Alias (CNAME)

  8. Next up, we'll configure DHCP.
    1. Click on Tools and open the DHCP Manager.
    2. First and foremost, right-click on and click on Authorize then click on the refresh icon on the toolbar.
    3. Expand, expand IPv4, and create the following Scope;
      Address Pool: Start IP:
      End IP:

      Scope Options: 003 Router
      006 DNS Server
      015 Domain Name

  9. Once that is done, we'll start configuring Active Directory Certificate Services (ADCS) on LON-DC1.
    1. Click on the notification icon and open the Configure Active Directory Certificate Services on the destination computer link. Click Next on the Credentials page.
    2. Select Certification Authority and Certification Authority Web Enrollment on the Role Services page.
    3. On the Setup Type screen, make sure that Enterprise CA is selected and on the CA Type page, Root CA is selected.
    4. On the Private Key page, click Next and on the Cryptography screen, change the Key length: to 4096 and select the option to Allow administrator interaction…
    5. Click Next and on the CA Name page, change the Common name for this CA: to AdatumCA
    6. Accept all other defaults and install Certificate Services.
    7. IMPORTANT...

    8. NOTE! When installing LON-CA1, make sure that on step c., the Setup Type is Standalone and CA Type is Root CA and on step e., the Common name for this CA: is set to AdatumRootCA.

    PowerShell baby!

    Next, let’s see how to do all that using Windows PowerShell… In half the time! Power’s Hell! AmIright, amIright!?

    Note: Most issues will arise from either:
    (a) not running PowerShell as Administrator (Right-click on PowerShell and Run as Administrator) or,
    (b) if your ExecutionPolicy is set to Restricted (Run the cmdlet Set-ExecutionPolicy RemoteSigned).

    If you are using a Windows Server host, run the following cmdlet first;

    Install-WindowsFeature Hyper-V-Tools,Hyper-V-PowerShell

    STEP 1: Grab some ISOs.

    Make sure you have performed Step 1 and grabbed some ISOs and placed them in the $Path location. In our case, $Path = C:\HVVM.

    STEP 2: Configure Networking

    Create Virtual Switches;

    New-VMSwitch -SwitchName “Private Network” -SwitchType Private
    New-VMSwitch -SwitchName “Private Network” 2 -SwitchType Private

    STEP 3: Create Virtual Machines

    To speed things up, you can copy and paste all the cmdlets into PowerShell...

    New-Item -ItemType Directory -Name HVVM -ErrorAction SilentlyContinue
    $Path = "C:\HVVM\"
    New-VM -Name LON-DC1 -Path $Path+LON-DC1 -MemoryStartupBytes 2GB -NewVHDPath $Path+“LON-DC1\Virtual Disks\LON-DC1.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-SVR1 -Path $Path+LON-SVR1 -MemoryStartupBytes 2GB -NewVHDPath $Path+“LON-SVR1\Virtual Disks\LON-SVR1.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-SVR2 -Path $Path+LON-SVR2 -MemoryStartupBytes 2GB -NewVHDPath $Path+“LON-SVR2\Virtual Disks\LON-SVR2.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-SVR3 -Path $Path+LON-SVR3 -MemoryStartupBytes 1GB -NewVHDPath $Path+“LON-SVR3\Virtual Disks\LON-SVR3.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-SVR4 -Path $Path+LON-SVR4 -MemoryStartupBytes 1GB -NewVHDPath $Path+“LON-SVR4\Virtual Disks\LON-SVR4.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-CA1 -Path $Path+LON-CA1 -MemoryStartupBytes 1GB -NewVHDPath $Path+“LON-CA1\Virtual Disks\LON-CA1.vhdx” -NewVHDSizeBytes 30GB -SwitchName “Private Network” -Generation 1
    New-VM -Name LON-CL1 -Path $Path+LON-CL1 -MemoryStartupBytes 2GB -NewVHDPath $Path+“LON-CL1\Virtual Disks\LON-CL1.vhdx” -NewVHDSizeBytes 20GB -SwitchName “Private Network” -Generation 1

    Create second hard drives for LON-DC1, LON-SVR1 and LON-SVR2 and attach them;

    New-VHD -Path $Path+“LON-DC1\Virtual Disks\LON-DC1-AllFiles.vhdx" -SizeBytes 10GB -Fixed
    New-VHD -Path $Path+“LON-SVR1\Virtual Disks\LON-SVR1-AllFiles.vhdx" -SizeBytes 10GB -Fixed
    New-VHD -Path $Path+“LON-SVR2\Virtual Disks\LON-SVR2-AllFiles.vhdx" -SizeBytes 10GB -Fixed

    Configure Processors;

    Set-VMProcessor -VMName LON-DC1 -Count 4
    (Repeat for LON-SVR1 and LON-SVR2 changing the VMName parameter…)
    Set-VMProcessor -VMName LON-SVR3 -Count 2
    (Repeat for LON-CA1 changing the VMName parameter…)
    Set-VMProcessor -VMName LON-CL1 -Count 4

    Configure Virtual Machines to start from DVD (.iso);

    Set-VMDVDDrive -VMName LON-DC1 -Path C:\ISO\WS2012R2EntEval.ISO
    (Replace the path for the correct ISO and repeat for LON-SVR1, LON-SVR2, LON-SVR3, LON-SVR4and LON-CA1…)
    Set-VMDVDDrive -VMName LON-CL1 -Path C:\ISO\W10EntEval.ISO

    STEP 4: Now start the Virtual Machines and install Windows. You don't need PowerShell for that!

    But, say that you wanted to...


    STEP 5: Configure Windows IP and Networking settings. Again, PowerShell, no!

    But, again, say that you wanted to... First, log onto the VM and get the NIC interface index number.

    {Make a note of the ifIndex number of the NIC you want to make changes to. Let's assume #12.}
    Invoke-Command -VMName LON-DC1 -ScriptBlock {Set-NetIPAddress -InterfaceIndex 12 -IPAddress -PrefixLength 24}

    STEP 6: Install AD Domain Services, Promote DC, Configure DNS and DHCP.

    Install-WindowsFeature AD-Domain-Services,DNS,DHCP -IncludeAllSubFeature -IncludeManagementTools

    Install the Forest and Promote server to a domain controller.

    Import-Module ADDSDeployment
    Install-ADDSForest -CreateDNSDelegation:$false -DatabasePath C:\Windows\NTDS -DomainMode Win2012R2 -DomainName -DomainNetbiosName ADATUM -ForestMode Win2012R2 -LogPath C:\Windows\NTDS -NoRebootOnCompletion:$false -SysvolPath C:\Windows\SYSVOL -Force:$true

    NOTE:You will be prompted for the DSRM password and confirmation of the same, which will not echo on the screen, so type Pa$$w0rd carefully!
    Once completed, and NOT BEFORE, install AD Certificate Services on LON-DC1;

    Install-WindowsFeature ADCS-Cert-Authority,ADCS-Web-Enrollment -IncludeAllSubFeature -IncludeManagementTools

    Create the Resource Records;

    Add-DNSServerResourceRecordA -Name adfs -ZoneName -IPv4Address -TimeToLive 01:00:00
    Add-DNSServerResourceRecordCNAME -Name crl -HostNameAlias -ZoneName
    Add-DNSServerResourceRecordCNAME -Name EnterpriseRegistration -HostNameAlias -ZoneName

    Authorize the Server, create the Scope and set Scope Options;

    Add-DHCPServerv4Scope -StartRange -EndRange -SubnetMask -Name Adatum -Type Both
    Set-DHCPServerv4OptionValue -ScopeID -DNSDomain -DNSServer -Router

    Configure Active Directory Certificate Services
    On LON-DC1;

    Install-ADCSCertificationAuthority -CAType EnterpriseRootCA -CryptoProviderName "RSA#Microsoft Software Key Storage Provider" -KeyLength 4096 -HashAlgorithmName SHA1 -CACommonName AdatumCA -AllowAdministratorInteraction -ValidityPeriod Years -ValidityPeriodUnits 5

    On LON-CA1;
    Install-ADCSCertificationAuthority -CAType StandAloneRootCA -CryptoProviderName "RSA#Microsoft Software Key Storage Provider" -KeyLength 4096 -HashAlgorithmName SHA1 -CACommonName AdatumRootCA -AllowAdministratorInteraction -ValidityPeriod Years -ValidityPeriodUnits 5

    Once the server completes the installation and reboots automatically, you may now start the configuration of the other VMs. Do not forget to add the hosts to the domain.

    NOTE! All hosts are members of the domain, EXCEPT LON-CA1, which is a Standalone Root CA and SHOULD NEVER be connected to the domain!

    IP Configuration: (Subnet Mask:; DNS:

    LON-DC1: IP Address:; (Note! DNS is ITSELF.) This is a Domain Controller, Enterprise Root CA and hosts the domain.
    LON-CA1: IP Address:; This is a Member Server and Standalone Root CA in a Workgroup.
    LON-SVR1: IP Address:; This is a Member Server in the domain.
    LON-SVR2: IP Address:; This is a Member Server in the domain.
    LON-SVR3: IP Address:; This is a Member Server in the domain.
    LON-SVR4: IP Address:; This is a Member Server in the domain.
    LON-CL1: IP Address:; This is a Member Client in the domain.

    Enjoy your newly minted lab!


    To the Surface...