Use Diskpart to Create Hard Disk Partitions

There are several ways you can create hard disk partitions during an unattended installation. By creating additional hard disk partitions, you can create partitions for recovery scenarios, additional data storage areas, or other configurations.

  • Use the Microsoft-Windows-Setup component to configure one or more Disk settings to create or to modify partitions.
    For more information about using the Microsoft-Windows-Setup settings, see the Unattended Windows Setup Reference.
  • Use the DiskPart tool to create one or more partitions.
    For more information, see DiskPart Command-Line Options.

The Microsoft-Windows-Setup component does not include the ability to create hidden partitions, such as OEM partition types. To create these types of partitions, you must use the Diskpart command.

To Use Diskpart to Create Partitions

  1. Boot the computer by using Windows PE.
  2. Run Diskpart. Use the Diskpart command-line syntax to select the disk to configure and the types of partitions to create. For example, you can create a script file to use with Diskpart that creates an OEM-type partition and a primary partition.
  3. After the partitions are created, exit Diskpart.
  4. If required, you can use the Format command to format the partitions that you created. If you intend to format your partitions, remember to assign a drive letter to the partition, by using Diskpart.

You are now ready to install Windows. You can use the imagex /apply command to apply a Windows image to an available primary partition on the computer.

Optionally, you can use Windows Setup. If you use an answer file with Windows Setup, verify that the InstallTo setting in the Microsoft-Windows-Setup component matches the disk and the partition to which you intend to install Windows.