New-Partition
New-Partition
Creates a new partition on an existing Disk object.
Sintaxis
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>]
Descripción detallada
The New-Partiton cmdlet creates a partition on a specified Disk object. Note: This cmdlet does not support creating dynamic volumes.
Parámetros
-Alignment<UInt32>
Specifies the alignment boundary in bytes.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-AsJob
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-AssignDriveLetter
Assigns a drive letter to the new partition.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-CimSession<CimSession[]>
Ejecuta el cmdlet en una sesión remota o en un equipo remoto. Escriba un nombre de equipo o un objeto de sesión, como la salida de un cmdlet New-CimSession o Get-CimSession. El valor predeterminado es la sesión actual en el equipo local.
Alias |
Session |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-DiskId<String[]>
Specifies the ID of the disk on which to create the partition.
Alias |
Id |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-DiskNumber<UInt32[]>
Specifies the number of the disk.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
1 |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-DiskPath<String[]>
Specifies the path of the disk on which to create the partition.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByPropertyName) |
¿Aceptar caracteres comodín? |
false |
-DriveLetter<Char>
Specifies the specific drive letter to assign to the new partition.
Alias |
NewDriveLetter |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
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)
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-InputObject<CimInstance[]>
Especifica la entrada para este cmdlet. Puede usar este parámetro o puede canalizar la entrada a este cmdlet.
Alias |
ninguno |
¿Requerido? |
true |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
True (ByValue) |
¿Aceptar caracteres comodín? |
false |
-IsActive
Specifies that the object is marked active.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-IsHidden
Creates a hidden partition.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-MbrType<MbrType>
Specifies the type of MBR partition to create. Valid types are: Extended, FAT12, FAT16, FAT32, Huge, and IFS.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-Offset<UInt64>
Specifies the starting offset, in bytes.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
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.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-ThrottleLimit<Int32>
Especifica el número máximo de operaciones simultáneas que se pueden establecer para ejecutar el cmdlet. Si se omite este parámetro o es especifica un valor de 0
, Windows PowerShell ® calcula un límite óptimo para el cmdlet en función del número de cmdlets de CIM que se estén ejecutando en el equipo. El límite solo se aplica al cmdlet actual, no a la sesión ni al equipo.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
-UseMaximumSize
Creates the largest possible partition on the specified disk.
Alias |
ninguno |
¿Requerido? |
false |
¿Posición? |
named |
Valor predeterminado |
ninguno |
¿Aceptar canalización? |
false |
¿Aceptar caracteres comodín? |
false |
<CommonParameters>
Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Entradas
El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk
You can pipe a Disk object to the InputObject parameter.
Salidas
El tipo de resultado es el tipo de objetos que emite el cmdlet.
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Partition
This cmdlet outputs an object that represents the newly created partition.
Notas
- El objeto
Microsoft.Management.Infrastructure.CimInstance
es una clase contenedora que muestra objetos de Instrumental de administración de Windows (WMI). La ruta de acceso después del signo de número (#
) proporciona el espacio de nombres y el nombre de clase del objeto WMI subyacente.
Ejemplos
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-Partition -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