04: Microsoft Deployment Toolkit

We don’t strictly need MDT to do this but if we are going to build a sustainable environment then it’s pretty helpful to have furthermore with lots of servers to deploy there is some labour saving especially as it nicely integrates the language packs and drivers and installs VMware Tools.  Create a VM for MDT

$vm = Get-ResourcePool -Location Servers | New-VM -Name “MDT01” -DiskGB 30 -MemoryGB 2 -NumCpu 2 -CD -NetworkName “VM Network” -GuestId windows8Server64Guest 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

Get-NetworkAdapter $vm | Set-NetworkAdapter -Type Vmxnet3 -Confirm:$false Start-VM $vm | Open-VMConsoleWindow -FullScreen

Complete the Windows installation using the full GUI – not Server Core

Start the VMware Tools installation by mounting the VMware Tools ISO

Mount-Tools $vm

Install with

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

Set the IP address, DNS server and rename the computer

New-NetIPAddress -InterfaceAlias "Ethernet0" -IPAddress -PrefixLength 16 -DefaultGateway
Set-DnsClientServerAddress -InterfaceAlias "Ethernet0" -ServerAddresses
Rename-Computer -NewName MDT01 –Restart

Add it to the domain and then reboot

Add-Computer -Credential mylab\administrator -Domainname mylab.local -Restart

Install WDS Role and update the DHCP management tools and then set the scope options for PXE

Add-WindowsFeature WDS -IncludeManagementTools
Add-WindowsFeature RSAT-DHCP
Set-DhcpServerv4OptionValue -OptionId 66 -Value mdt01.mylab.local -ComputerName DC01    # Boot Server Host Name
Set-DhcpServerv4OptionValue -OptionId 67 -Value boot\x86\wdsnbp.com -ComputerName DC01  # Bootfile Name

Open Windows Deployment Services, expand Servers and right click on MDT01.mylab.local and choose Configure Server

  1. Choose Integrate with Active Directory
  2. Accept the default local path of C:\RemoteInstall
  3. Respond to all client computers (no approval required)
  4. Finish the Wizard without adding any boot images

Download Windows Assessment and Deployment Kit (ADK) version 8.1 and install.  Skip the installation SQL Express and the features that require it: ACT, Windows Assessment Services

Download Microsoft Deployment Toolkit (MDT) 2013 accepting all the default options

Open Deployment Workbench. Create a new deployment share by click on Deployment Share and from the Action pane choosing New Deployment Share

  1. Use default path of C:\DeploymentShare
  2. Default share name of DeploymentShare$
  3. Default description “MDT Deployment Share”
  4. Don’t select any of the options for: backup, product, key, local admin password, image capture, Bitlocker
  5. Confirm the summary page and finish

Many of the following tasks can easily be repeated using PowerShell. These two commands need to be executed one once per PowerShell session

Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1"
New-PSDrive -Name "DS001" -PSProvider MDTProvider -Root "C:\DeploymentShare"

Click on MDT Deployment Share under Deployment Shares and click Properties from the Action pane.  Select the Rules tab and add the last two lines shown below


We have already prestaged the ISO files needed on the VMFS volume.  Mount the first ISO for Windows 8.1 x86

Get-CDDrive $vm | Set-CDDrive -IsoPath "[VMFS01] ISO\SW_DVD9_SA_Win_Ent_8.1_32BIT_English_-2_MLF_X19-49843.ISO" -Connected $true -Confirm:$false

Expand MDT Deployment Share and click on the Operating Systems folder.  Choose Import Operating System from the Action pane

  1. Add Full Set of source files
  2. Source directory of d:\
  3. Accept the default directory name “Windows 8.1 Enterprise x86”
  4. Accept the Summary and wait for the import to complete

Repeat the mount and the import on the Windows 8.1 x64 and the Windows Server 2012 R2 images

Mount the Language Pack ISO

Get-CDDrive $vm | Set-CDDrive -IsoPath "[VMFS01] ISO\SW_DVD5_Win_8.1_W32_MultiLanguage_except_ChnTrad_Language_Pack_X18-97873.ISO" -Connected $true -Confirm:$false

Expand MDT Deployment Share and click on the Packages folder.  From the action pane choose Import OS Package

  1. Set the source directory to \langpacks\en-gb
  2. Confirm the summary and finish

For easy repetition this can be achieved via PowerShell with

import-mdtpackage -path "DS001:\Packages" -SourcePath "d:\langpacks\en-gb" -Verbose

Repeat the mount and the import on the Windows 8.1 x64 and the Windows Server 2012 R2 language packs

Expand MDT Deployment Share and click on the Out-of-Box Drivers folder.  From the action pane choose import drivers

  1. Set the source folder to C:\Program Files\Common Files\VMware\Drivers
  2. Confirm the summary and finish

Or import via PowerShell

import-mdtdriver -path "DS001:\Out-of-Box Drivers" -SourcePath "c:\Program Files\Common Files\VMware\Drivers\" -Verbose

The only problem is that Common Files only contains the x64 ParaVirtual SCSI drivers.  So it is also necessary to mount VMtools ISO and then import the drivers from there

import-mdtdriver -path "DS001:\Out-of-Box Drivers" -SourcePath "D:\Program Files\VMware\VMware Tools\Drivers\" -Verbose

Expand MDT Deployment Share and click on the Applications

  1. Application without source files or on the network
  2. Details: VMware, VMware Tools x86 and
  3. Command line: Setup64.exe /S /v"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"
  4. Working directory: \\mylab\site1\data\VMware\Tools\

Applications can be imported via PowerShell as well

import-MDTApplication -path "DS001:\Applications" -enable "True" -Name "VMware Tools x64" -ShortName "VMware Tools x64" -Version "" -Publisher "" -Language "" -CommandLine "setup64.exe /S /v`"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs`"" -WorkingDirectory "\\mylab\site1\data\VMware\Tools\" -NoSource -Verbose
import-MDTApplication -path "DS001:\Applications" -enable "True" -Name "VMware Tools x86" -ShortName "VMware Tools x86" -Version "" -Publisher "" -Language "" -CommandLine "setup.exe /S /v`"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs`"" -WorkingDirectory "\\mylab\site1\data\VMware\Tools\" -NoSource -Verbose

Add another new application

  1. Application without source files or on the network
  2. Details: VMware, View Agent x86 and 6.1.1-2769635
  3. Command line: VMware-viewagent-6.1.1-2769635.exe /s /v"/qn ADDLOCAL=ALL REMOVE=VPA,SmartCard"
  4. Working directory: \\mylab\site1\data\VMware\View\6.1.1

Or complete with PowerShell

import-MDTApplication -path "DS001:\Applications" -enable "True" -Name "View Agent x86 6.1.1-2769635" -ShortName "View Agent" -Version "6.1.1-2769635" -Publisher "" -Language "" -CommandLine "VMware-viewagent-6.1.1-2769635.exe /s /v`"/qn ADDLOCAL=ALL REMOVE=VPA,SmartCard`"" -WorkingDirectory "\\mylab\site1\data\VMware\View\6.1.1" -NoSource -Verbose
import-MDTApplication -path "DS001:\Applications" -enable "True" -Name "View Agent x64 6.1.1-2769635" -ShortName "View Agent" -Version "6.1.1-2769635" -Publisher "" -Language "" -CommandLine "VMware-viewagent-x86_64-6.1.1-2769635.exe /s /v`"/qn ADDLOCAL=ALL REMOVE=VPA,SmartCard`"" -WorkingDirectory "\\mylab\site1\data\VMware\View\6.1.1" -NoSource -Verbose

Create a new Task Sequence

  1. Set the Task Sequence ID to Win81x86
  2. Set the name to Windows 8.1 x86
  3. Select the Standard Client Task Sequence
  4. Select OS of Windows 8.1 Enterprise x86
  5. Do not specify the product key
  6. Set Full Name and Organization to “My Lab” and homepage to http://www.bing.com
  7. Set the local admin password
  8. Confirm summary and complete

Extract TS.xml included in the ZIP file in the PDF file from VMware and overwrite C:\DeploymentShare\Control\Win81x86\ts.xml

Expand MDT Deployment Share and click on the Task Sequences folder.  Select the task Windows 8.1 x86 in the right hand pane and in the action pane choose Properties.  Once open switch to the Task Sequence tab and update the following

  1. Under Install\Install Operating System select Windows 8.1 Enterprise x86 from loaded earlier
  2. Under Custom Tasks\Modifications to Standard Image\Install VMware Tools select the VMware Tools x86 application created earlier
  3. Under Custom Tasks\Modifications to Standard Image\Install View Agent x86 select the View x86 Agent application created earlier

Select the MDT Deployment Share in the left hand pane and choose Update Deployment Share from the action pane.  This builds the boot image including the injecting the drivers

Create a new task sequence

  1. Choose “Standard Server Task Sequence”
  2. Windows 2012 R2 Server Standard (not core)
  3. No product key
  4. Registered to Fairfield
  5. Local admin password

Command line version

import-mdttasksequence -path "DS001:\Task Sequences" -Name "Windows Server 2012 R2" -Template "Server.xml" -Comments "" -ID "Win2012R2" -Version "1.0" -OperatingSystemPath "DS001:\Operating Systems\Windows Server 2012 R2 SERVERSTANDARD in Windows Server 2012 R2 SERVERSTANDARDCORE x64 install.wim" -FullName "My Lab" -OrgName "My Lab" -HomePage "about:blank" -AdminPassword "***" -Verbose

Update the deployment share boot images with

update-MDTDeploymentShare -path "DS001:" -Verbose

Then open WDS and in the left hand pane expand Servers, MDT01.mylab.local then click on Boot Images with the right hand mouse button.  Choose Add Boot Image and import the boot image from C:\DeploymentShare\Boot\LiteTouchPE_x86.wim