Create Extra Partition in MDT and Deploy Task Sequence

Prajwal Desai
Posted by Prajwal Desai

In this post, we will see how to create extra partition in MDT and save time when redeploy the system keeping the data partition.

During several interventions with the customer, we noticed that re-imaging takes a lot of time by copying the data to an external disk and then restoring it.

In most cases the customers request formatting C: drive while data on another drive remain as it is. Hence to save time we can create a D: (Data) partition where user documents will be redirected. Configure MDT to install new system on only partition C without formatting the Data drive.

Step 1 – Create Extra Partition in MDT

First we will look to create extra partition in MDT. We will create a new task sequence for a machine that doesn’t have an extra partition. Specify the TS name and comments. Click Next.

Create a new Task Sequence
Create a new Task Sequence

On the Select Template page, click the drop-down and select Standard Client Task Sequence. Complete the remaining steps.

Standard Client Task Sequence
Standard Client Task Sequence

Edit the task sequence and click the New Computer only step. Within that step, click Format and Partition Disk(BIOS) step and edit it.

Format and Partition Disk Step
Format and Partition Disk Step

You can resize the Windows partition size either by specifying the size in GB or Percentage.

Modify Primary Partition Size
Modify Primary Partition Size

Create another partition and rename it Data for example. Chose a large part of the percentage. PS : 95% represents the totality of the part deducted after the first allocation. For example if we reserve 70% for first partition of a hard drive with 100GB, in the second partition data we will have 95% for rest 100gb. Then 95% of 30GB, about 28GB, the rest is for recovery partition.

MDT Create Extra Partition and Deploy Task Sequence Snap5

This is how the your configuration should look like.

MDT Create Extra Partition and Deploy Task Sequence Snap6

You have repeat the same steps for UEFI partition as well.

MDT Create Extra Partition and Deploy Task Sequence Snap7

Deploy the task sequence to a machine. Notice that the MDT task sequence creates an extra partition and you can see that in the below screenshot.

MDT Create Extra Partition and Deploy Task Sequence
MDT Create Extra Partition and Deploy Task Sequence

Create a new test file on the other drive (D: drive).

MDT Create Extra Partition and Deploy Task Sequence Snap9

Step 2 – Create file and script .bat to save the data

Now we will create another task sequence to keep our partition and data. Create a new Task sequence as the first task, and rename it Remast for example.

MDT Create Extra Partition and Deploy Task Sequence Snap10

Create a new file and rename it format.txt. Place this file on the folder scriptroot on your MDT folder deployment directory. Edit format.txt and enter the below data and save the file.

MDT Create Extra Partition and Deploy Task Sequence Snap11

Step 3 – Create a Second Task Sequence to keep data

Edit the task sequence and change the settings as described in below screenshot. Disable the step: Format and partition (BIOS) and Format and partition (UEFI).

MDT Create Extra Partition and Deploy Task Sequence Snap12

Select the step Format C: Only. Create new Run command Line with the parameters: Diskpart /s %scriptroot%\format.txt.

MDT Create Extra Partition and Deploy Task Sequence Snap13

Click the Options tab and select Continue on error. Set the condition Task Sequence variable IsUEFI not equals True.

MDT Create Extra Partition and Deploy Task Sequence Snap14

Step 4 – Apply the change and assign the script

Create a new batch file and place it on scripts folder of MDT deployment share. I will be creating a new folder named ‘Master’ and place my batch file script.

This script will be stop the installation from UEFI mode if the system letter is not C: That can protect our task from an error. This is my script.

MDT Create Extra Partition and Deploy Task Sequence Snap15

Edit the task sequence (remaster) and create a new command line, to launch our script.

MDT Create Extra Partition and Deploy Task Sequence Snap16

Ensure you select the same configuration as listed below.

MDT Create Extra Partition and Deploy Task Sequence Snap17

In the same task sequence, go to install operating system step, and change this parameters for Bios mode

MDT Create Extra Partition and Deploy Task Sequence Snap18

Repeat the same for the UEFI mode, change the condition to specific logical drive and enter letter C:

MDT Create Extra Partition and Deploy Task Sequence Snap19

Finally close the task sequence.

Step 5 – Deploy and Test

Deploy the Task Sequence. If you are re imaging the machine, select task ‘Remaster’.

Select the tasks sequence to execute
Select the tasks sequence to execute

Once the imaging is complete, notice that data partition is still present and untouched. So we can conclude that the data is preserved in the data partition that we created.

Data preserved in another drive
Data preserved in another drive

The text file is still present on the D: drive.

MDT Create Extra Partition and Deploy Task Sequence Snap22
Share This Article
Prajwal Desai
Posted by Prajwal Desai
Follow:
Prajwal Desai is a Microsoft MVP in Intune and SCCM. He writes articles on SCCM, Intune, Windows 365, Windows Server, Windows 11, WordPress and other topics, with the goal of providing people with useful information.
4 Comments