> ## Content Index
> Fetch the complete content index at: https://www.filipkonopik.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# PowerShell: Get Total Disk Size
- URL: https://www.filipkonopik.com/powershell-get-total-disk-size/
- Published: 2026-07-19T02:23:17.000Z
- Updated: 2026-08-06T05:24:11.000Z
- Author: Filip Konopík
- Tags: Storage Devices

Need to check the total capacity of a drive - for inventory, capacity planning, or comparing against free space? This one-liner pulls the total size for every disk on the machine, converted into a readable format.

Prerequisites:

- Privileges: None
- Module: Built-in, no import needed

Quick Command:

```Powershell
Get-CimInstance Win32_LogicalDisk | Select-Object Name, @{Name="Size";Expression={[math]::Round($_.Size / 1GB, 2)}}
```

Example Output:

```Powershell
Name   Size
----   ----
C:   254.51
Y:   228.27
Z:   228.27
```

📦

****Want all of them at once?**  
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.

[Get the Complete Bundle for $39](https://gum.co/u/oczvkqdc?ref=filipkonopik.com)

How It Works:

- Get-CimInstance Win32\_LogicalDisk queries the logical disk class, which holds info about every drive letter recognized by the system, including local disks, mapped network drives, and removable media.
- Size returns the total capacity of the drive in raw bytes by default, which isn't very readable on its own.
- The calculated property @{Name="Size"; Expression={...}} creates a custom column that converts the raw byte value into gigabytes - $\_.Size / 1GB divides the current disk's size by 1GB (a built-in PowerShell unit equal to 1,073,741,824 bytes).
- math\]::Round(..., 2) rounds the result to 2 decimal places, since dividing bytes by 1GB often produces a long, unreadable decimal.

Pro Tip:

Combine this with free space to see both total and remaining capacity in one view:

```PowerShell
Get-CimInstance Win32_LogicalDisk | Select-Object Name, @{Name="SizeGB";Expression={[math]::Round($_.Size / 1GB, 2)}}, @{Name="FreeSpaceGB";Expression={[math]::Round($_.FreeSpace / 1GB, 2)}}
```