Powershell Shrink/Extend Volume in Windows Server 2019/2022

by John, Updated on: June 15, 2026

PowerShell is a task-based command-line shell and scripting language built on the .NET framework. It helps system administrators and power users rapidly automate tasks that manage operating systems and underlying processes. Native commands allow you to manage enterprise computers directly from the terminal console. The engine includes a rich expression parser alongside a fully developed scripting environment. Since this command-line terminal handles numerous administration tasks, is it possible to alter disk limits natively? The answer is yes. This article explains how to resize partitions with PowerShell in Windows Server 2019/2022 by safely shrinking or extending volumes.

How to shrink volume with PowerShell in Windows Server 2019/2022

First, press the Windows key + X on your keyboard, then select Windows PowerShell (Admin) from the menu list.

Steps to shrink partition volumes with PowerShell in Windows Server 2019/2022:

  1. Type diskpart in the command window and press Enter to initialize the command-line disk tool.
  2. Type list volume and press Enter to view all available disk drives in a comprehensive layout list.
  3. Type select volume D and press Enter. (Replace D with the number or drive letter of your target partition.)
  4. Type shrink desired=YY and press Enter to reduce boundaries. (YY represents the specific storage value in megabytes.)

Immediately, the interface reports that the selected volume has been successfully shrunk down to its new boundary layout.

Note: Only partitions formatted with the NTFS file system architecture are supported by this native mechanism.

Powershell shrink

How to extend volume with PowerShell in Windows Server 2019/2022

If you want to expand a volume using command scripts, the process is not as straightforward as reducing its capacity limits. First, you are required to delete the right contiguous partition located directly next to your target drive layout. If there is no adjacent space block available or you cannot remove it, built-in features cannot complete the expansion.

Steps to extend partition with PowerShell in Windows Server 2019/2022 by removing drives:

  1. Type diskpart in the PowerShell command window and press Enter to open the terminal management engine.
  2. Type select volume D and press Enter. (D represents the drive letter or drive number of your right contiguous partition.)
  3. Type delete volume and press Enter to permanently erase the partition block and clear adjacent disk space.
  4. Type select volume C and press Enter. (C represents the number or drive letter of the target partition you want to expand.)
  5. Type extend and press Enter to allocate the newly generated unallocated space container.

Run the list volume command again. As illustrated on the storage panel, the system C drive has been extended from 40GB to 110GB.

Extend successfully

Powershell extend

Limitations to resize partition with PowerShell in Windows Server 2019/2022

After executing the diskpart interpreter within the console window, run the help shrink and help extend strings. Doing this reveals the constraints encountered when you attempt a partition reconfiguration workflow on active system drives.

Shrink limitations

Extend limitations

Limitations to resizing partitions with PowerShell in Windows Server 2019/2022:

Since the native Windows Server 2019 Disk Management console shares these identical structural limitations, running professional server partition software is highly recommended.

Besides executing a volume adjustment routine natively, using specialized utilities bypasses contiguous blockers to optimize environments without data loss.

Download NIUBI Partition Editor and follow the actions demonstrated in the video guides to adjust drive layouts safely.

How to extend system partition C by shrinking other volume:

Video Server 2019

How to extend D drive by shrinking other partition:

Video Server 2019

Beyond resizing and modifying boundaries across legacy platforms, this high-performance optimization toolkit streamlines routine server low-level volume administration tasks seamlessly.