A lot of users are confused about the PowerShell get disk space operation on Windows 10/11. In this post, MiniTool introduces 4 cmdlets to check disk space PowerShell and an alternative to show disk usage.

As it’s well known to us all, PowerShell is a powerful Windows built-in command-line shell and scripting environment tool. It can be used to handle various works such as installing Windows updates, PowerShell get folder size, PowerShell SSH, PowerShell unzip/zip, PowerShell runs exe, and the one discussed in this post.

However, lots of users and even professionals are not familiar with how to deal with these works in PowerShell. Here we focus on PowerShell check disk space and provide an alternative to free up disk space on Windows 10/11.

How to Update PowerShell Version to v7.2.5 for Windows 10/11
How to Update PowerShell Version to v7.2.5 for Windows 10/11

How to update PowerShell for Windows 10/11? Now, you come to the right place. This post provides you with 2 simple ways to update PowerShell on Windows 10/11.

Read More

Can PowerShell Get Disk Space

Can PowerShell get free disk space? Of course, yes! There are various cmdlets that can be used to let PowerShell get free disk space on Windows 10/11. After investigating extensive references and posts, we find the following 4 commands can be used to check disk space in PowerShell.

  • PowerShell Get-Volume: This cmdlet will show a list of all the volumes available on your system, including the file system type, health status of each volume, and total/free disk usage size in GB.
  • PowerShell Get-PSDrive: This cmdlet can return you with a list of all drives on your system, including provider, root, and total used/free disk space size in GB.
  • PowerShell Get-WmiObject: This cmdlet plus the win32_logicaldisk PowerShell script can display the total size, allocated, and free space of the logical drives.
  • PowerShell Get-CimInstance: This cmdlet can get total and free disk space on a local or remote computer.

How to Check Disk Space PowerShell on Windows 10/11

Now, I believe that you already have known all the PowerShell disk space check cmdlets. Let’s see how to let PowerShell check disk space using these cmdlets on Windows 10/11.

Way 1. PowerShell Get Disk Space via the Get-Volume Command

The first and simplest method for the “PowerShell get free disk space” operation is to use the Get-Volume command. Here we summarize 2 common examples as follows.

# 1. Show All Drives and Space Allocation on the Computer

To do this work, you just need to open the PowerShell window by pressing Win + R to open the Run box, typing powershell in it, and pressing Enter. Then type the following command in PowerShell and hit Enter.

Get-Volume

run Get Volume in PowerShell

Now, you should find a list of drives and their information, including free disk space and total disk space on the local computer.

# 2. PowerShell Free Disk Space for a Specified Drive

If you want to get free disk space for a particular drive like C, you can run the following command in PowerShell. Here you can replace C with other drive letters that you want to check.

Get-Volume -DriveLetter C

show a specified drive information in PowerShell

Way 2. PowerShell Get Disk Space via the Get-PSDrive Command

Another simple way is to use the Get-PSDrive PowerShell disk usage check cmdlet. Here’s how to use this cmdlet.

# 1. Show Free Disk Space for All Drives on the Computer

If you want to know the free disk space of all drives in GB, you can directly run the Get-PSDrive cmdlet in PowerShell. Once run, you can view the used/free disk space, provider, and root for all drives.

Get-PSDrive

run Get PSDrive in PowerShell

# 2. Show Free Space for a Particular Drive

To get the used/free disk space for a specified drive, you just need to run Get-PSDrive + drive letter command. Here we take C drive for example.

Get-PSDrive C

run Get PSDrive C in PowerShell

Way 3. PowerShell Get Disk Space via the Get-WmiObject Command

If you want to get the all information about your logical drives, the Get-WmiObject plus Win32_logicalDisk PowerShell script is a good choice. Here’s how to use this cmdlet.

# 1. Show Free Space for All Drives on the Local Computer

Type the following command and hit Enter. Then you will get the total and free space of all drives in GB.

Get-WmiObject -Class win32_logicaldisk | Format-Table DeviceId, MediaType, @{n="Size";e={[math]::Round($_.Size/1GB,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1GB,2)}}

run Get WmiObject in PowerShell

Also, you can run the following command to get free/total disk space and the free percentage of each drive on the local computer.

Get-WmiObject -Class Win32_LogicalDisk |

Select-Object -Property DeviceID, VolumeName, @{Label='FreeSpace (Gb)'; expression={($_.FreeSpace/1GB).ToString('F2')}},

@{Label='Total (Gb)'; expression={($_.Size/1GB).ToString('F2')}},

@{label='FreePercent'; expression={[Math]::Round(($_.freespace / $_.size) * 100, 2)}}|ft

run Get WmiObject Win32 LogicalDisk in PowerShell

# 2. Check Free Disk Space on Remote Computers

If you want to know the total free disk space on the remote computers, you can also use the Get-WmiObject cmdlet. Here you need to replace the computer name according to the actual situation.

Get-WmiObject -Class Win32_logicalDisk -ComputerName srv01,srv02,srv03

Way 4. PowerShell Get Disk Space via the Get-CimInstance Command

In addition, the Get-CimInstance cmdlet can help you check free disk space on both local and remote computers.

# 1. Show Free Disk Space of All Drives on a Local Computer

To get the total/free disk space of all drives on a local computer, you can run the following command in PowerShell.

Get-CimInstance -Class win32_logicaldisk | Format-Table DeviceId, MediaType, @{n="Size";e={[math]::Round($_.Size/1GB,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1GB,2)}}

run Get CimInstance in PowerShell

Also, you can run the following command to know more information about the drives such as free percentages.

Get-CimInstance -Class Win32_LogicalDisk |
Select-Object -Property DeviceID, VolumeName, @{Label='FreeSpace (Gb)'; expression={($_.FreeSpace/1GB).ToString('F2')}},
@{Label='Total (Gb)'; expression={($_.Size/1GB).ToString('F2')}},
@{label='FreePercent'; expression={[Math]::Round(($_.freespace / $_.size) * 100, 2)}}|ft

show free percentage of a drive using Get CimInstance

# 2. Get Free Disk Space on Remote Computers

If you want to total/free space of a particular drive like C on remote computers, you can run the following command in PowerShell. Here you need to replace the computer name and drive letter according to your needs.

Get-CimInstance -ComputerName computername win32_logicaldisk | where caption -eq "C:" | foreach-object {write " $($_.caption) $('{0:N2}' -f ($_.Size/1gb)) GB total, $('{0:N2}' -f ($_.FreeSpace/1gb)) GB free "}

Better Alternative to PowerShell Get Free Disk Space

Although PowerShell can help you check free disk usage on Windows, these cmdlets are too complex and hard to remember. So, we highly recommend you use an easier and more practical alternative to PowerShell check disk space – MiniTool Partition Wizard.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

With this MiniTool software, you can get all the basic information of all drives like system file type, total/used/free space, and used percentage. More importantly, it can help your free up disk space using many powerful features like Space Analyzer, Extend/Resize/Move Partition, Migrate OS to larger HDD/SSD, etc.

MiniTool Partition Wizard main interface

  • linkedin
  • reddit