PowerShell, Windows

How To: Resize Disk Partition with PowerShell

If you need to expand a disk partition on a Windows system (which has PowerShell) then you can quickly and efficiently do so with the following commands further down.

Step 1 – Use Get-Volume to identify the disk(s) which you want expanding:

Step 2 – Use Get-PartitionSupportedSize -DriveLetter C to check if and to what size it can be expanded:

Step 3 – Here we store to $size variable the output from the command in Step 2 and then we resize the partition to its maximum size:

Step 4 – Result

twitterredditpinterestlinkedinmail

3 Comments

  1. Orlando Paez

    How do i do a query on the drive to see if it is healthy prior to expanding it? What i need to do is see if the Dirty Bit is flagged or not, then continue with patritioning the drive.

    Reply
  2. Rangaraj

    Get-volume and Get-PartitionSupportedSize commandlet you have mentioned is not available in powershell.

    Could you please help me .

    Thank you.

    Reply
    1. Corin Author

      You need at least Powershell version 4. Alternatively you can use WMI – Get-WMIObject -Class Win32_Volume | Select DriveLetter,FreeSpace,Capacity,DeviceID,Label

      Reply

Leave a Comment

Your email address will not be published. Required fields are marked *