Monthly Archives: April 2014

DiskPart GUI PowerShell

Summary: Use Windows PowerShell to build graphic user interface script to automate DiskPart.
DiskPart is a command-line utility used to manipulate disk partitions in all versions of Windows and Windows Server beginning with Windows XP and Windows Server 2003. See the DiskPart reference link: . We can type DiskPart commands directly, or script DiskPart to perform multiple commands via a text file script.
Honorary Scripting Guy, Sean Kearney, posted a blog with a PowerShell script example which automates the use of DiskPart: Automating DiskPart with Windows PowerShell –
I loved this post and particularly the way how he created PS objects and parsed information from DiskPart command. And since I use Windows Preinstallation Environment (AKA Windows PE and WinPE), I wanted to use PowerShell to build a DISKPART script to automatically format USB drives as bootable. Furthermore, I wanted to create DiskPart graphic user interface tool for all of my colleagues that do not like command line as much as I do. In order to achieve this I had to create a few PowerShell functions, and the end result is here:
And if you want to make both USB flash drives bootable with WinPE version 5.0, just select both drives and browse to the location of the WinPE bootable files (C:\WinPe_x64\bootiso\media) or in case of WinPE version 3.0 (C:\WinPE_x64\ISO), as shown in the picture below:
The end result will be two bootable USB drives with WinPE version 5.0.
The PowerShell script and DiskPart tool created for both 32 bit and 64 bit could be found in the downloaded section –
Let me know what you think.