Diskpart during an OSD Task Sequence

2017-12-04T11:41:09+00:00 January 13th, 2012|Azure, Cloud, Windows|

Whilst at a customer recently I had a requirement to run a ‘Diskpart /Clean’ at the start of a task sequence to remove any encryption on the drive, in this case McAfee. I have done this several times in the past however always hit a few niggles so thought I would blog to refer to in the future 🙂

The easiest way to do this is to perform the following;

  1. Mount your Windows PE image(s) to a directory
  2. Create a text file called ‘CleanPartitions.txt’ (for arguments sake), with the following content;
    • Select Disk 0
    • Clean
  3. Copy this text file to ‘<Mounted Folder>WindowsSystem32’ (again, for arguments sake)
  4. Commit the mounted folder back to the .WIM

In your task sequence, before the standard ‘Format and Partition Disk’ phase, perform the following;

  1. Add a ‘Run Command Line’ task
  2. In the ‘Command Line:’ text area, type;
    • diskpart.exe /s “%windir%system32CleanPartitions.txt”
  3. Disable 64-bit file redirection
  4. Save the task sequence

This should now run successfully and remove any encryption on the drive 🙂

It is worth noting that this will only work in a Lite-touch situation as you will need to either PXE-boot or use bootable media. There is a solution that McAfee have released that allows you to perform this end-to-end in a Zero-Touch situation that I will blog about soon.

Cheers

SteveH