Optimize Drives With Optimize-Volume

Run defrag or TRIM on a chosen volume with a scriptable cmdlet.

WindowsperformancediskpowershellLow risk
Run Optimize-Volume -DriveLetter C -Defrag -Verbose to defragment the C: volume.

01Command

Command
$ Optimize-Volume -DriveLetter C -Defrag -Verbose

02What it does

Optimize-Volume chooses the right operation for the media (defrag for spinning disks, retrim for SSDs) and reports progress as objects. Being a cmdlet, it can be invoked on a schedule or across many machines without opening the Optimize Drives dialog on each one.

03Risk

RiskLow risk
RequirementsRun PowerShell as Administrator
!Warning: Defragmenting a virtual or SSD volume is unnecessary and can add wear; match the operation to the hardware.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Optimize-Volume
    Microsoft Learn · vendor-doc · 2026-09-20
    Evidence: Performs defragmentation, trim and other optimization on a volume.

Last verified: 2026-10-13 · Category: System & Settings

06Related solutions