Recreating a real world scenario….virtually (Part One)

Alejandro Reyes
Tech Jobs Academy
Published in
4 min readAug 3, 2016

Author’s Note: This post will be the initiation of a series in which I will be creating an infrastructure for a company called Contoso. It will consist of four virtual machines connected to an isolated network. We will have Active Directory and Federation Services along with a Windows 8.1 as a client on our virtual infrastructure. Some background in Hyper-V and servers will be useful to fully understand. Some prior knowledge in PowerShell will come in handy for parts one and two since all the setup will be done through it.

PART ONE: SETUP OF VIRTUAL MACHINES

Creating four VHD’s (Virtual Hard Disks) & connecting them to their respective VM (Virtual machine).

In order to begin we will be creating four VHD’s we will first create a folder in which all the VHD’s will be stored. In this case they will be stored on our internal hard drive inside a folder named Contoso_Lab2. The following command is done on PowerShell in order to create the folder inside our E drive.

New-Item -ItemType Directory -Path <Desired Path>
This screenshot demonstrates how we created our folder

This command below creates virtual hard disks and this was done for the following:

  • ContosoAD2 120GB (Will contain Active Directory)
  • ContosoFS2 120GB (Will contain Federation Services)
  • Windows8_1Client2 120GB (Will contain our Windows 8.1 Client)
  • Scripts2 10GB (Will be a VHD in which we will place all of our scripts inside)
New-VHD -Path E:\Contoso_Lab2\<Desired Name of VHD>.vhd -SizeBytes <desired space>GB
This procedure was done for each VHD.

Next we need to create our virtual machines for each VHD. PowerShell was also used in this case, since it was much more faster then using the GUI (Graphic User Interface).

New-VM -Name<insert VMname here> -MemorystartupBytes <desired RAM> GB -VHDPath E:\Contoso_Lab2\<Name of VHD>
Only the creation of virtual machines for ContosoAD and ContosoFS is needed.

This portion consists of creating a private network switch named ContosoPrivate2 and connect your VMs.

First we need to create our virtual switch. In this case it will be private since we want our computers to isolated for now.

New-VMSwitch -Name <Insert Name of the switch> -SwitchType <Desired switch type>

The next step is to connect each VM to the newly created virtual switch. This will allow them to communicate with each other.

Connect-VmNetworkAdapter -VMName <name of VM> -SwitchName <Name of the switch> 
This step is done for each respective VM.

Mounting ISO

The final step for this first part of the series will be installing the VM’s. All the configurations and modifications can be done through there Hyper-V Manager GUI, but we will continue to use PowerShell since it can be quicker to make the changes. Before starting up the machines and installing, we need to mount the ISO file to each machine. In my case I already had the ISO files containing the evaluation versions for Windows Microsoft Server 2012 and Windows 8.1. ContosoAD and ContosoFS will both run Windows Server 2012R2 meanwhile Windows 8.1 will be on Windows8_1Client2.

Set-VMDvdDrive -VmName <Name of VM> -Path <Path to the ISO>
This is done for each VM

I personally like to verify that all the installation configuration was done correctly before launching and starting the virtual machines. For this I use the GUI in Hyper-V Manager. In order to view this you need to open Hyper-V Manager then you right-click the desired VM and select Settings. Below is a screenshot of my configured settings for ContosoAD2.

Screenshot of VM settings

Conclusion…for now

This concludes the end of part one for this mini-series. By now you have two virtual machines named ContosoAD2, ContosoFS2 and Windows8_1Client2. with their respective VHDs and an extra VHD for Scripts any PowerShell scripts. Part two will be covering the installation of Windows Server and Windows 8.1.

--

--