How to Check Hard Drive Space using PowerShell?

As a system or PowerShell administrator, you might need to monitor disk space, whether on a single PC or across hundreds of servers. In this tutorial, you’ll learn how to check hard drive space using PowerShell on Windows 10, Windows 11, and Windows Server.

Before running PowerShell commands:

  • Use Windows PowerShell 5.1 or PowerShell 7+
  • Run PowerShell as Administrator (especially for remote queries)
  • Ensure WinRM is enabled for remote access

Now, let me show you different methods to check disk space.

Method 1: Check Disk Space Using Get-PSDrive

The simplest way to check available space is with the built-in Get-PSDrive cmdlet.

Get-PSDrive -PSProvider FileSystem

Output Example:

Name     Used (GB)     Free (GB)     Provider      Root
----     ---------     ---------     --------      ----
C        120           380           FileSystem    C:\
D        200           800           FileSystem    D:\

Explanation:

  • Name → Drive letter
  • Used and Free → Space metrics in GB
  • Provider → The type of drive (FileSystem, Registry, etc.)

Best for: Quick local checks on all drives.

Here is the exact output in the screenshot below:

powershell check hard drive space

Check out How to Get .NET Version Using PowerShell?

Method 2: Use Get-Volume for Detailed Disk Information

For more detailed info such as filesystem type, health status, and capacity, use:

Get-Volume

Example Output:

DriveLetter FileSystemLabel FileSystem HealthStatus SizeRemaining Size
----------- ---------------- ---------- ------------ ------------- ----
C            System          NTFS       Healthy      380 GB        500 GB
D            Data            NTFS       Healthy      800 GB        1000 GB

Here is the exact output in the screenshot below:

Check Hard Drive Space using PowerShell

Tip: You can format the output for readability:

Get-Volume | Select-Object DriveLetter, FileSystem, Size, SizeRemaining, HealthStatus

Read Delete User Profiles Using PowerShell in Windows 11

Method 3: Check Disk Space with WMI (Legacy but Powerful)

For advanced scripting or remote queries, WMI (Windows Management Instrumentation) is extremely useful.

Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object DeviceID,
@{Name='Size(GB)';Expression={[math]::Round($_.Size/1GB,2)}},
@{Name='FreeSpace(GB)';Expression={[math]::Round($_.FreeSpace/1GB,2)}}

Explanation:

  • DriveType=3 filters for local disks only
  • Converts bytes to gigabytes for readability

Best for: Automation scripts and remote servers.

Method 4: Check Disk Space on Remote Computers

To query another computer’s disk space remotely:

Invoke-Command -ComputerName "Server01" -ScriptBlock {
    Get-PSDrive -PSProvider FileSystem
}

Pro Tip:
If you need to check multiple machines at once:

$computers = @("Server01", "Server02", "Server03")
Invoke-Command -ComputerName $computers -ScriptBlock {
    Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3" |
    Select DeviceID, @{Name='FreeSpace(GB)';Expression={[math]::Round($_.FreeSpace/1GB,2)}}
}

Check out Track User Login History on Windows Using PowerShell

Method 5: Export Disk Space Report to CSV

To generate a disk space report for auditing or monitoring:

Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object DeviceID,
@{Name='Size(GB)';Expression={[math]::Round($_.Size/1GB,2)}},
@{Name='FreeSpace(GB)';Expression={[math]::Round($_.FreeSpace/1GB,2)}} |
Export-Csv "C:\Reports\DiskSpaceReport.csv" -NoTypeInformation

Now you can open the report in Excel or Power BI for analysis.

Method 6: Send Email Alerts When Disk Space Is Low

You can automate alerts when free space drops below a certain threshold.

$threshold = 10  # GB
$drives = Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3"

foreach ($drive in $drives) {
    $free = [math]::Round($drive.FreeSpace / 1GB, 2)
    if ($free -lt $threshold) {
        Send-MailMessage -To "admin@company.com" -From "server@company.com" `
        -Subject "Low Disk Space Alert on $($drive.DeviceID)" `
        -Body "Drive $($drive.DeviceID) has only $free GB free." `
        -SmtpServer "smtp.company.com"
    }
}

Best for: IT administrators monitoring multiple servers or workstations.

Check out Set the Default Printer Using PowerShell in Windows

Common Troubleshooting

Here are some common troubleshooting tips you can follow, and these are from my experience.

IssuePossible CauseSolution
Access denied when querying remote PCWinRM not enabledRun Enable-PSRemoting -Force on remote system
Incorrect disk size valuesBytes not convertedUse [math]::Round($_.Size/1GB,2)
Script not sending emailSMTP not configuredVerify SMTP server and credentials

I hope you now understand how to check hard drive space using PowerShell using different methods.

You may also like the following tutorials:

Leave a Comment

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.