共用方式為


ModifyPartition

Applies To: Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista

ModifyPartition specifies a single partition on a disk to be modified

One or more ModifyPartition list items can exist in the ModifyPartitions parent list.

The following table shows the modifications that can be made to various partition types.

Partition Type Active Extend Format Letter Label TypeID
Primary Yes Yes Yes Yes Yes Yes
Logical No Yes Yes Yes Yes Yes
EFI System (ESP) No No Yes Yes Yes No

Microsoft Reserved (MSR) cannot be modified.

Extended partitions cannot be modified.

Child Elements

Active

Specifies whether the partition is active.

Extend

Specifies whether to extend the partition to use the remainder of the contiguous space on the hard disk.

Format

Specifies the file-system format to apply to the partition.

Label

Specifies the name to apply to the partition.

Letter

Specifies the drive letter to assign to the partition.

Order

Specifies the order in which the partition will be modified.

PartitionID

Specifies the identification number of the partition to modify.

TypeID

Specifies the hard drive partition type.

Valid Configuration Passes

windowsPE

Parent Hierarchy

Microsoft-Windows-Setup | DiskConfiguration | Disk | ModifyPartitions | ModifyPartition

Applies To

For a list of the Windows® editions and architectures that this component supports, see Microsoft-Windows-Setup.

XML Example

The following XML output shows two partition modifications. The first modification formats the partition for the NTFS file system, marks the partition as active, and labels it "System". The second modification formats the second partition on the disk to NTFS, labels it "Windows", and extends the partition to fill the remainder of the disk.

<DiskConfiguration>

  <Disk wcm:action="add">
    <DiskID>0</DiskID> 
    <WillWipeDisk>true</WillWipeDisk> 
    <CreatePartitions>

      <!-- System partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Size>350</Size> 
      </CreatePartition>

      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>2</Order> 
        <Type>Primary</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>System</Label> 
        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Windows</Label> 

        <Format>NTFS</Format> 
      </ModifyPartition>
    </ModifyPartitions>
  </Disk>


  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>


<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>2</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

See Also

Concepts

ModifyPartitions