The New-Partition PowerShell command is a powerful tool that allows users to create and manage partitions on their hard drives. This command is part of the Windows Management Framework (WMF) and is available in Windows 10, Windows 8.1, Windows 8, and Windows 7. It is also available in Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, and Windows Server 2008 R2.

The New-Partition command is used to create a new partition on a hard drive. It can also be used to modify existing partitions, such as changing the size of a partition or deleting a partition. This command can also be used to create a new volume on a hard drive.

Syntax

The syntax for the New-Partition command is as follows:

New-Partition -DiskNumber -PartitionNumber -Size -DriveLetter -FileSystem -Confirm:$false

Parameters

The New-Partition command has the following parameters:

Parameter Description
DiskNumber The number of the disk on which the partition will be created.
PartitionNumber The number of the partition to be created.
Size The size of the partition to be created, in megabytes.
DriveLetter The drive letter to assign to the partition.
FileSystem The file system to use for the partition.
Confirm A switch to confirm the operation.

Inputs

The inputs for the New-Partition command are the parameters listed above. The DiskNumber, PartitionNumber, Size, DriveLetter, and FileSystem parameters are all required. The Confirm parameter is optional.

Outputs

The output of the New-Partition command is a partition object that contains information about the newly created partition. This object can be used to manage the partition.

Examples

The following example creates a new partition on disk 0 with a size of 500 megabytes and assigns it the drive letter E:

New-Partition -DiskNumber 0 -PartitionNumber 1 -Size 500 -DriveLetter E -FileSystem NTFS -Confirm:$false

Tips

Here are some tips for using the New-Partition command:

  • Make sure you have enough free space on the disk to create the partition.
  • Be sure to specify the correct disk number when creating a partition.
  • When creating a partition, make sure to specify a valid drive letter.
  • When creating a partition, make sure to specify a valid file system.
  • When creating a partition, make sure to specify the correct size.
  • When creating a partition, make sure to set the Confirm parameter to $false.

Conclusion

The New-Partition command is a powerful tool for creating and managing partitions on hard drives. It can be used to create a new partition, modify an existing partition, or create a new volume. The command has several parameters that must be specified in order for it to work properly. By following the tips outlined above, users can ensure that their partitions are created correctly.

Leave a Reply