Post

Setting Up a Microsoft Deployment Server!

Setting up a Microsoft Deployment Server!

Introduction

In this guide, we will walk you through the process of setting up a Microsoft Deployment Server. Microsoft Deployment Server (MDT) is designed to simplify the deployment of Windows operating systems and applications in an enterprise environment. Whether you need to deploy Windows to multiple computers or customize your installations for specific needs, MDT provides the tools and processes to make it all possible.

Prerequisites

Before you begin, ensure that you have the following:

Step 1: Install Windows ADK for Windows 11, and MDT 8456

Follow the video guide to see a more detailed step by step installation.

1) Install ADK for Windows 11

2) Install Windows PE add-on for ADK

3) Install Microsoft Deployment Toolkit

4) Download and apply the MDT 8456 Hotfix

5) Download the Chocolatey Wrapper for MDT (The script below should normally take care of this, but if the download link ever changes you have the original blogpost to go to)

Step 2: Create the MDT Deployment Share

You can do this manually, but below is a script to speed this proces up. This will also create a local user with a password, feel free to change the password in the script

Lastpass password generator

Create a local useracccount:

1
net user /add SVC_MDT P@SSw0Rd!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#Requires -Version 3
#Requires -RunAsAdministrator

###
### Variables
###

$MDTDeploymentShareFolder = 'D:\DeploymentShare'
$MDTDeploymentShareName = 'DeploymentShare$'
$MDTChocolateyApplications = @('7zip','adobereader','googlechrome','firefox','javaruntime','dotnet3.5','dotnet4.5') # You need a chocolatey wrapper in order for this to work https://keithga.wordpress.com/2014/11/25/new-tool-chocolatey-wrapper-for-mdt/

$WDSRemoteInstallFolder = 'D:\RemoteInstall'

$ErrorActionPreference = 'Stop'

###
### Script
###

	
	Write-Output 'Seting up Scratch Folder'
    if(!(Test-Path -path c:\temp))  
{  
	mkdir "c:\temp"
    }
    else 
{ 
Write-Host "The given folder path c:\temp already exists"; 
}
	mkdir "c:\temp\Drivers\x64_winpe10"
	mkdir "c:\temp\Drivers\Laptop"
	mkdir "c:\temp\Drivers\Desktop"
	mkdir "c:\temp\software\Windows Kits\10\ADK"
	
   Try
{
   Write-Output 'Adding Windows feature NET-Framework-Core'
    Add-WindowsFeature NET-Framework-Core

    Write-Output 'Adding Windows feature Windows Deployment System'
    Add-WindowsFeature WDS -IncludeManagementTools

	Write-Output 'Downloading Chocolatey Wrapper'
	Invoke-WebRequest 'https://raw.githubusercontent.com/keithga/DeployShared/master/Templates/Distribution/Scripts/Extras/Install-Chocolatey.ps1' -Outfile 'c:\temp\Install-Chocolatey.ps1'
  

   Write-Output 'Setting up MDT'
    mkdir $MDTDeploymentShareFolder
    $Share = [wmiClass]'Win32_share'
    $Share.create($MDTDeploymentShareFolder,$MDTDeploymentShareName,0)

       Import-Module 'C:\Program Files\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1' -Force    
    New-PSDrive -Name 'DS001' -PSProvider 'MDTProvider' -Root $MDTDeploymentShareFolder -NetworkPath "\\$env:COMPUTERNAME\$MDTDeploymentShareName" -Description 'DeploymentShare' -Verbose | Add-MDTPersistentDrive -Verbose
    #New-Item -path 'DS001:\Operating Systems' -enable 'True' -Name 'WIN7X64' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Operating Systems' -enable 'True' -Name 'WIN11X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Operating Systems' -enable 'True' -Name 'SRV2012R2X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Operating Systems' -enable 'True' -Name 'SRV2016X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Task Sequences' -enable 'True' -Name 'WIN7X64' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Task Sequences' -enable 'True' -Name 'WIN11X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Task Sequences' -enable 'True' -Name 'SRV2012R2X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Task Sequences' -enable 'True' -Name 'SRV2016X64' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Out-of-Box Drivers' -enable 'True' -Name 'WINPE' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Out-of-Box Drivers' -enable 'True' -Name 'DESKTOP' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Out-of-Box Drivers' -enable 'True' -Name 'LAPTOP' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Packages' -enable 'True' -Name 'WIN7X64' -Comments '' -ItemType folder -Verbose
    New-Item -path 'DS001:\Packages' -enable 'True' -Name 'WIN11X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Packages' -enable 'True' -Name 'SRV2012R2X64' -Comments '' -ItemType folder -Verbose
    #New-Item -path 'DS001:\Packages' -enable 'True' -Name 'SRV2016X64' -Comments '' -ItemType folder -Verbose
    new-item -path "DS001:\Selection Profiles" -enable "True" -Name "WINPE" -Comments "" -Definition "<SelectionProfile><Include path=`"Out-of-Box Drivers\WINPE`" /></SelectionProfile>" -ReadOnly "False" -Verbose
    #new-item -path "DS001:\Selection Profiles" -enable "True" -Name "WIN7X64" -Comments "" -Definition "<SelectionProfile><Include path=`"Packages\WIN7X64`" /></SelectionProfile>" -ReadOnly "False" -Verbose
    new-item -path "DS001:\Selection Profiles" -enable "True" -Name "WIN11X64" -Comments "" -Definition "<SelectionProfile><Include path=`"Packages\WIN11X64`" /></SelectionProfile>" -ReadOnly "False" -Verbose
    #new-item -path "DS001:\Selection Profiles" -enable "True" -Name "SRV2012R2X64" -Comments "" -Definition "<SelectionProfile><Include path=`"Packages\SRV2012R2X64`" /></SelectionProfile>" -ReadOnly "False" -Verbose
    #new-item -path "DS001:\Selection Profiles" -enable "True" -Name "SRV2016X64" -Comments "" -Definition "<SelectionProfile><Include path=`"Packages\SRV2016X64`" /></SelectionProfile>" -ReadOnly "False" -Verbose
    $MDTChocolateyApplications | % {
        $Package = $_
        $Path = "powershell.exe -NoProfile -ExecutionPolicy unrestricted `"%ScriptRoot%\Install-Chocolatey.ps1`" -verbose -Packages `"$Package`""
        Import-MDTApplication -path "DS001:\Applications" -Name $Package -ShortName $Package -NoSource -CommandLine $Path -Enable $true
     }
    Copy-Item -Path 'c:\temp\Install-Chocolatey.ps1' -Destination $MDTDeploymentShareFolder\Scripts
	
	#Bootstrap Rules
	Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "DeployRoot=\\$env:computername\DeploymentShare$"
	Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "UserID=$env:computername\SVC_MDT" #Change $env:computername to domain name if needed.
	Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "UserPassword=P@SSw0Rd!"
    Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "KeyboardLocalePE=0813:00000813"
    Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "KeyboardLocale=0813:00000813"
    Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "KeyboardLocalePE=nl-BE"
    Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "KeyboardLocale=nl-BE"
    Add-Content $MDTDeploymentShareFolder\control\Bootstrap.ini "SkipBDDWelcome=YES"
	
	#CustomSettings Rules
	#Change Priority to  => Priority=Serialnumber,DefaultGateway,MacAddress,TaskSequenceID,Model,ByLaptopType,ByDesktopType
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "[ByLaptopType]"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "Subsection=Laptop-%IsLaptop%"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "[ByDesktopType]"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "Subsection=Desktop-%IsDesktop%"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "[Laptop-True]"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "DriverGroup001=LAPTOP\%Model%"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "DriverSelectionProfile=nothing"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "[Desktop-True]"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "DriverGroup001=DESKTOP\%Model%"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "DriverSelectionProfile=nothing"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "[Virtual Machine]"
	Add-Content $MDTDeploymentShareFolder\control\CustomSettings.ini "DriverSelectionProfile=nothing"
	
	
	
	#Importing Drivers
	#WINPE Drivers Windows 10
	import-mdtdriver -path "DS001:\Out-of-Box Drivers\WINPE" -SourcePath "c:\temp\Drivers\x64_winpe10" -ImportDuplicates -Verbose
		
	#Update MDT Share	
    Update-MDTDeploymentShare -path 'DS001:' -Verbose


}
Catch
{
    Throw $_
} 

Step 3 Change the custom.ini priority:

1
Priority=Serialnumber,DefaultGateway,MacAddress,TaskSequenceID,Model,ByLaptopType,ByDesktopType,Default

Step 4 Import the Chocolatey Wrapper for MDT into the scripts folder

1
D:\DeploymentShare\

Step 5 Add your Windows installation and create a Task Sequence

After you have added your installation media and created a task Sequence you can finally test your deployment. PXE boot should work out of the box. In the video i show you a demonstration to a virtual machine.

In some cases you have to add some DHCP options to your dhcp server, i would suggest to test your PXE first because it should work in this configuration. If it does not work to read the manual specific to your router.

What is next?

In a future episode we will be customizing the Deployment Server and try to automate as much as possible during the deployment steps.

Special thanks to:

Johan Arwidmark

Keith Garner

This post is licensed under CC BY 4.0 by the author.