

To delete all partitions from disks and completely clear data, run the commandĬlear-Disk -Number 1 -RemoveData -Confirm:$false Get-Partition –DiskNumber 1,2 | Remove-Partition -Confirm:$false To remove all partitions on disks 1 and 2 without confirmation, run this command: Let’s format new partition in the NTFS and set the DBData volume label:įormat-Volume -DriveLetter L -FileSystem NTFS -NewFileSystemLabel DBData -Confirm:$false Set-Partition -DriveLetter U -IsActive $true Formatting a partition with PowerShell If you want to make a partition active, this command is used:

Resize-Partition -DriveLetter L -Size $MaxSize $MaxSize = (Get-PartitionSupportedSize -DriveLetter L).SizeMax Then you can extend the size of the partition to the maximum:

Get-PartitionSupportedSize -DriveLetter L | Format-List If you want to expand the existing partition, first of all display the available unallocated space to extend this partition: Set-Partition –DriveLetter L -NewDriveLetter U You can change the assigned letter using this command: New-Partition –DiskNumber 1 -AssignDriveLetter –UseMaximumSize To assign a letter automatically, the AssignDriveLetter parameter is used ( sometimes Windows doesn’t assign a drive letter automatically ). If you want the partition to occupy all available disk space, use the UseMaximumSize attribute. New-Partition –DiskNumber 1 -Size 10gb -DriveLetter L Let’s create a 10 GB partition and assign the letter L: to it: To create a new partition on a disk, the New-Partition cmdlet is used. You can try to recover the partition table and data on your RAW disk as follows. Please note that a disk may have the RAW status when the partition table is corrupted.
