IT Toolbox
Menu
PowerShell · Storage

Check available disk space on Windows

Lists local volumes and calculates their utilization rate to quickly identify a full disk.

Low risk

Command

Get-Volume | Where-Object DriveLetter | ForEach-Object { $Used = $_.Size - $_.SizeRemaining [PSCustomObject]@{ Lecteur = $_.DriveLetter Nom = $_.FileSystemLabel Taille_Go = [math]::Round($_.Size / 1GB, 1) Utilise_Go = [math]::Round($Used / 1GB, 1) Libre_Go = [math]::Round($_.SizeRemaining / 1GB, 1) Occupation_Pc = if ($_.Size) { [math]::Round(($Used / $_.Size) * 100, 1) } else { 0 } } } | Sort-Object Occupation_Pc -Descending | Format-Table -AutoSize

When to use it

Run this before an update, when a server becomes slow, or when a backup fails because of insufficient space.

How it works

  • The command calculates used space from total capacity and remaining free space.
  • The fullest volumes are displayed first.

Precautions

  • This command does not delete any files.
  • A volume above 90% usage usually deserves further investigation.

Rollback

No rollback is required.

Support the development of BAOI Hosting, domains and new IT resources.
❤️ Support BAOI