次の方法で共有


New-Partition

New-Partition

Creates a new partition on an existing Disk object.

Syntax

Parameter Set: ByNumber
New-Partition [-DiskNumber] <UInt32[]> [-Alignment <UInt32> ] [-AsJob] [-AssignDriveLetter] [-CimSession <CimSession[]> ] [-DriveLetter <Char> ] [-GptType <String> ] [-IsActive] [-IsHidden] [-MbrType <MbrType> ] [-Offset <UInt64> ] [-Size <UInt64> ] [-ThrottleLimit <Int32> ] [-UseMaximumSize] [ <CommonParameters>]

Parameter Set: ByPath
New-Partition -DiskPath <String[]> [-Alignment <UInt32> ] [-AsJob] [-AssignDriveLetter] [-CimSession <CimSession[]> ] [-DriveLetter <Char> ] [-GptType <String> ] [-IsActive] [-IsHidden] [-MbrType <MbrType> ] [-Offset <UInt64> ] [-Size <UInt64> ] [-ThrottleLimit <Int32> ] [-UseMaximumSize] [ <CommonParameters>]

Parameter Set: ByUniqueId
New-Partition -DiskId <String[]> [-Alignment <UInt32> ] [-AsJob] [-AssignDriveLetter] [-CimSession <CimSession[]> ] [-DriveLetter <Char> ] [-GptType <String> ] [-IsActive] [-IsHidden] [-MbrType <MbrType> ] [-Offset <UInt64> ] [-Size <UInt64> ] [-ThrottleLimit <Int32> ] [-UseMaximumSize] [ <CommonParameters>]

Parameter Set: InputObject (cdxml)
New-Partition -InputObject <CimInstance[]> [-Alignment <UInt32> ] [-AsJob] [-AssignDriveLetter] [-CimSession <CimSession[]> ] [-DriveLetter <Char> ] [-GptType <String> ] [-IsActive] [-IsHidden] [-MbrType <MbrType> ] [-Offset <UInt64> ] [-Size <UInt64> ] [-ThrottleLimit <Int32> ] [-UseMaximumSize] [ <CommonParameters>]

Detailed Description

The New-Partiton cmdlet creates a partition on a specified Disk object. Note: This cmdlet does not support creating dynamic volumes.

Parameters

-Alignment<UInt32>

Specifies the alignment boundary in bytes.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-AssignDriveLetter

Assigns a drive letter to the new partition.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CimSession<CimSession[]>

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Aliases

Session

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DiskId<String[]>

Specifies the ID of the disk on which to create the partition.

Aliases

Id

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DiskNumber<UInt32[]>

Specifies the number of the disk.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DiskPath<String[]>

Specifies the path of the disk on which to create the partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DriveLetter<Char>

Specifies the specific drive letter to assign to the new partition.

Aliases

NewDriveLetter

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-GptType<String>

Specifies the type of GPT partition to create (by GUID). By default, the New-Partition cmdlet creates a basic GPT data partition.

The GUIDs of valid types are:
-- System Partition (c12a7328-f81f-11d2-ba4b-00a0c93ec93b)
-- Microsoft Reserved (e3c9e316-0b5c-4db8-817d-f92df00215ae)
-- Basic data (ebd0a0a2-b9e5-4433-87c0-68b6b72699c7)
-- Microsoft Recovery (de94bba4-06d1-4d40-a16a-bfd50179d6ac)

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InputObject<CimInstance[]>

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-IsActive

Specifies that the object is marked active.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IsHidden

Creates a hidden partition.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MbrType<MbrType>

Specifies the type of MBR partition to create. Valid types are: Extended, FAT12, FAT16, FAT32, Huge, and IFS.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Offset<UInt64>

Specifies the starting offset, in bytes.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Size<UInt64>

Specifies the size of the partition to create. If not specified, then the units will default to Bytes. The acceptable value for this parameter is a positive number followed by the one of the following unit values: Bytes, KB, MB, GB, or TB.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ThrottleLimit<Int32>

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UseMaximumSize

Creates the largest possible partition on the specified disk.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk

    You can pipe a Disk object to the InputObject parameter.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition

    This cmdlet outputs an object that represents the newly created partition.

Notes

  • The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.

Examples

Example 1: Create a new partition on disk 1

This example creates a new partition on disk 1, using the maximum available space, and automatically assigning a drive letter.

PS C:\> New-Partiton -DiskNumber 1 -UseMaximumSize -AssignDriveLetter

Example 2: Get all RAW disks, initialize the disks, partition, and format them

This example uses five cmdlets and the pipeline to get all disks, filter them for only RAW, unpartitioned disks, initialize the disks, partition the disks, and then format them.

This line gets all disk objects and then pipes the objects to the next command.

PS C:\> Get-Disk |

This line selects only objects where the PartitionStyle property value equals "RAW", and then pipes the objects to the next command.

PS C:\> Where-Object PartitionStyle –Eq "RAW" |

This line initializes all Disk objects in the pipeline and then pipes the objects to the next cmdlet.

PS C:\> Initialize-Disk -PassThru |

This line creates a maximum sized partition on each initialized Disk object, assigns a drive letter to the partitions, and then pipes the objects to the next cmdlet.

PS C:\> New-Partition -AssignDriveLetter -UseMaximumSize |

This line formats all newly partitioned disks.

PS C:\> Format-Volume

Add-PartitionAccessPath

Get-Partition

Set-Partition

Initialize-Disk

Format-Volume

Select-Object