Diskpart during an OSD Task Sequence
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;
- Mount your Windows PE image(s) to a directory
- Create a text file called ‘CleanPartitions.txt’ (for arguments sake), with the following content;
- Select Disk 0
- Clean
- Copy this text file to ‘<Mounted Folder>\Windows\System32′ (again, for arguments sake)
- Commit the mounted folder back to the .WIM
In your task sequence, before the standard ‘Format and Partition Disk’ phase, perform the following;
- Add a ‘Run Command Line’ task
- In the ‘Command Line:’ text area, type;
- diskpart.exe /s “%windir%\system32\CleanPartitions.txt”
- Disable 64-bit file redirection
- 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


Any updates on McAfee suggested solution? I tried it but its not playing nice so far.
Unfortunately not. McAfee do have a document available which I was working from earlier this year but the solution is very convoluted and at the time did not seem worthwhile as we were only looking at a couple of hundred laptops that would not be rebuilt that regulary in any case.
The document can be found here;
https://kc.mcafee.com/resources/sites/MCAFEE/content/live/PRODUCT_DOCUMENTATION/23000/PD23237/en_US/McAfeeEE5x_WindowsOSRefres_v1_1.pdf
The key issue I had was Appendix C and coming up with a solution to stage the WinPE image whilst suppressing the reboot so that I could reset the MBR to McAfee’s EPR. In SCCM Zero-Touch the ‘Reboot’ task sequence step incorporates the staging and reboot process and without developing your own script it is difficult to separate.
Be interested to hear if you have any success with this, good luck
Thanks,