03: Domain Controller

e’re not going to get much further without a Windows Active Directory aka Domain Controller.

Download the following ISO files from Microsoft.  They are: Windows 2012 R2, Language Pack, Windows 8.1 x86 and x64, Language Pack

  • SW_DVD9_SA_Win_Ent_8.1_64BIT_English_-2_MLF_X19-49847.ISO
  • SW_DVD5_Win_8.1_W32_MultiLanguage_except_ChnTrad_Language_Pack_X18-97873.ISO
  • SW_DVD9_SA_Win_Ent_8.1_32BIT_English_-2_MLF_X19-49843.ISO
  • SW_DVD5_Win_8.1_64Bit_MultiLanguage_except_ChnTrad_Language_Pack_X18-97875.ISO
  • SW_DVD5_NTRL_Win_Svr_Language_Pack_2012_R2_64Bit_MultiLang_FPP_VL_OEM_X19-05196.ISO
  • SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_-3_MLF_X19-53588.ISO

Create a folder C:\ISO and save them there.  Copy that folder to the VMFS volume using PSCP.  To use PSCP we need the SSH service running on the host

Get-VMHostService -VMHost 10.0.1.1 | where {$_.key -eq 'TSM-SSH'} | Start-VMHostService

Copy the ISO folder across – case is important here

pscp –r c:\ISO root@10.0.1.1:/vmfs/volumes/VMFS01

Now create a VM for it

$vm = New-VM -Name "DC01" -VMHost 10.0.1.1 -DiskGB 30 -MemoryGB 2 -NumCpu 2 -CD -NetworkName "VM Network" -GuestId windows8Server64Guest

Change the network adapter type from e1000 to VMXNet3. This seemed essential in the lab setup as the virtual e1000 cards would frequently drop off the network

Get-NetworkAdapter $vm | Set-NetworkAdapter -Type Vmxnet3 -Confirm:$false

Mount the ISO file on the VM

Get-CDDrive $vm | Set-CDDrive -IsoPath "[VMFS01] ISO\SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_-3_MLF_X19-53588.iso" -StartConnected $true –Confirm:$false

Boot the VM and open the console

Start-VM $vm | Open-VMConsoleWindow –FullScreen

Now you should be looking at a screen like this… Set the Time and Keyboard country.  Language is only US at this point.

image

Click Install now

image

Install Windows 2012 R2 Server Core

image

Accept the EULA

image

Custom installation

image

Install on the only disk available by clicking Next

image

Wait for Windows to install

imageimage

Set the local administrator password

imageimage

That’s it – we are now at a Server Core prompt

image

Mount the VMware Tools ISO by running this command on the admin machine

Mount-Tools $vm

Then within the VM run the installer and reboot when prompted

d:\setup64.exe /v"/qb REBOOT=y"

After the reboot, login again and invoke PowerShell by typing powershell at the c: prompt

image

Set a static IP address

New-NetIPAddress -InterfaceAlias "Ethernet0" -IPAddress 10.0.1.5 -PrefixLength 16 -DefaultGateway 10.0.0.1

Set the computer name

Rename-Computer -NewName DC01 –Restart

From the PowerShell prompt run

Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools

Run this command to create the Forest. It will prompt you to create a new domain password

Install-ADDSForest -DomainName mylab.local

After the reboot create the reverse DNS lookup zone

Add-DnsServerPrimaryZone -NetworkId "10.0.0.0/16" -ReplicationScope Forest

Install DHCP

Add-WindowsFeature dhcp -IncludeManagement Tools

Bind the DHCP server to the IPv4 network interface

Set-DhcpServerv4Binding -BindingState $true -InterfaceAlias "Ethernet0"

Create a new Scope called “LAN”

Add-DhcpServerv4Scope -Name "LAN" -StartRange 10.0.254.0 -EndRange 10.0.254.255 -SubnetMask 255.255.0.0

Set basic DHCP options

Set-DhcpServerv4OptionValue -OptionId 3 -Value 10.0.0.1  # Default router / gateway
Set-DhcpServerv4OptionValue -OptionId 4 -Value 10.0.1.5  # Time Server
Set-DhcpServerv4OptionValue -OptionId 6 -Value 10.0.1.5  # DNS Server
Set-DhcpServerv4OptionValue -OptionId 15 -Value "mysite.local"  # DNS Domain Name

Authorise DHCP server in the Domain

Add-DhcpServerInDC -DnsName "dc01.mylab.local"

Back on the admin machine – add it to the domain

Add-Computer -Domain mylab.local

Login as administrator@mylab.local

Install the Remote Server Administration Tools for Windows 8.1

Install Firefox

Install Flash Player

Now PowerCLI will probably not work as it sets the PowerShell module path in the user rather than system environment.  Therefore add C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules to the PSModulesPath system variable