Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / PowerShell / How to Find Large Files on a Computer with PowerShell

September 26, 2024

How to Find Large Files on a Computer with PowerShell

To find large files on a computer, you can use Windows File Explorer, one of the third-party tools (such as WinDirStat or TreeSize), or your favorite file manager. In some cases, it is more convenient to use PowerShell commands to quickly find large files on a computer because there is no need to install third-party tools.

For example, to list the 10 largest files on a particular drive, run the following PowerShell command

Get-ChildItem -Path c:\ -Recurse –Force| sort -descending -property length | select -first 10 FullName, Length

After some time (depending on the size of the partition and the number of files), the command will return a list of the 10 largest files, sorted by size.

find top 10 large files on a computer using powershell

The Get-ChildItem cmdlet is used to get a list of files in a directory (or you can use one of the aliases: ls , dir or gci ). The following parameters are used in the above command to find large files::

  • -Path C:\ — path to the directory to search files. You can perform a full disk search or a folder search (for example, in a user profile or shared folder). If the path is not specified, the current directory is searched. The -Path parameter allows to specify multiple folders and drive letters to search (separated by commas): -Path C:\,G:\,D:\IS0,F:\Downloads
  • -Recurse – this option indicates that a recursive search should be performed in all subdirectories. To restrict the folder search to a certain depth level, use the -Depth parameter.
  • -Force – option is used to include hidden folders and system folders (files) in the search (which are ignored by default).
  • Sort -descending -property Length – sort files by size in descending order (by the Length property).
  • Select FullName, Length – show the full path to the file and its size.
  • -first 10 – list the first 10 files only.
Tip. Even if you have administrative privileges, the cmdlet might return an access error when it tries to access some system directories:

Get-ChildItem : Access to the path 'C:\Windows\CSC' is denied.
At line:1 char:1
+ Get-ChildItem c:\ -r| sort -descending -property length | select -fir ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Windows\CSC:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : DirUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand

Add the -ErrorAction SilentlyContinue parameter to the Get-ChildItem command to suppress these errors.

Get-ChildItem : Access to the path is denied

By default, the Get-ChildItem cmdlet displays file sizes in bytes. Change the command as follows to convert them to gigabytes (GB):

Get-ChildItem c:\ -r -Force -ErrorAction SilentlyContinue |sort -descending -property length | select -first 10 name, DirectoryName, @{Name="GB";Expression={[Math]::round($_.length / 1GB, 2)}}

PowerShell: show large file size in GBs

The resulting list of large files can be converted into a convenient graphical table using the Out-GridView cmdlet:

Get-ChildItem c:\ -r -Force -ErrorAction SilentlyContinue |sort -descending -property length | select -first 10 name, DirectoryName, @{Name="GB";Expression={[Math]::round($_.length / 1GB, 2)}} | Out-GridView

Get-ChildItem folder size Out-GridView

Find all files on a hard drive larger than 10GB and export the list to a CSV file:

GCi C:\ -Recurse -Force -ErrorAction SilentlyContinue | where-object {$_.length -gt 10GB} | Sort-Object length | ft fullname,length| Export-Csv c:\pc\LargeFiles_Report.csv

Certain file types can be included or excluded from the search scope using the -Include and -Exclude options. For example, exclude files with SYS and VMDK extensions from the output:

Get-ChildItem G:\ -Exclude "*.sys","*.vmdk" -Recurse -Force -ErrorAction SilentlyContinue| sort -descending -property length | select -first 10 FullName, Length

To retrieve only files that match some filter criteria, use the -Filter option. For example, -Filter "*image*".

You can search for large files on a remote computer. In this case, specify the UNC path to a shared folder as the Get-ChildItem parameter (it is possible to specify the UNC path to the admin shares C$, D$ on a remote computer):

Get-ChildItem -Path \\PC123\C$ -Recurse |where-object {$_.length -gt 10GB} |sort -descending -property length | select -first 10 FullName, Length

Or, use the Invoke-Command cmdlet to get a list of the largest files on multiple computers:

$ComputerList = @("server1","server2")
Invoke-Command -ComputerName $ComputerList -ScriptBlock {gci -Path C:\ -r| sort -descending -property length | select -first 10 name, length}

3 comments
6
Facebook Twitter Google + Pinterest
PowerShell
previous post
Managing Printers and Drivers on Windows with PowerShell
next post
FTP Server Quick Setup on Windows 10/11 and Windows Server

Related Reading

Generating Strong Random Password with PowerShell

January 31, 2020

How to Get My Public IP Address with...

August 13, 2026

Transfer/Seize FSMO Roles to Another Domain Controller in...

March 24, 2026

Disks and Partitions Management with PowerShell on Windows

July 11, 2025

Get-MessageTrackingLog: Search Message Tracking Logs on Exchange Server

October 28, 2021

How to See Number of Active User Sessions...

March 16, 2024

How to Backup Hyper-V Virtual Machines (Tutorial)

November 9, 2023

Fix: DNS Resolution over VPN Doesn’t Work on...

December 27, 2023

3 comments

Leoš Marek April 2, 2019 - 7:52 am

You have a typo in the code GCi C:\ -recurse -ErrorAction –Force SilentlyContinue. The -Force should be after SilentlyContinue

Reply
admin April 3, 2019 - 5:59 am

Thank you mate. I will fix it.

Reply
murat handan December 3, 2024 - 12:28 pm

sadece dosyalarımı mı buluyor? mesela beni bir dizinim var c:\dvnm12 bunun içinde yüzlerce dosya var ama bunu bulmuyor çünkü tek dosya yok

Does it only find my files? For example, I have a directory c:\dvnm12 which contains hundreds of files but it does not find it because there is not a single file

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • How to Convert Windows Machine into a Proxmox VM

    August 30, 2026
  • Enable or Disable Fast User Switching in Windows 11

    August 18, 2026
  • How to Hide Wi-Fi Network in Windows with WLAN Filters (Blacklist and Whitelist)

    August 14, 2026
  • Invalid Signature Detected: Check Secure Boot Policy [Fix]

    August 5, 2026
  • Windows Installer Service Could Not Be Accessed? How to Fix It

    July 28, 2026
  • Why Windows Reports No Internet Access: How Connectivity Detection Works

    July 26, 2026
  • Inactive TS Ports in Windows: Causes and Fixes

    July 20, 2026
  • Add Wireless Wi-Fi Profiles on Windows Devices via Export/Import or GPO

    July 13, 2026
  • CrowdSec on Windows: From Installation to Threat Blocking

    July 3, 2026
  • Manage Microsoft Store Apps with Store CLI in Windows 11 from Terminal

    July 2, 2026

Follow us

  • Facebook
  • Twitter
  • Youtube
  • Telegram
Popular Posts
  • Managing Printers and Drivers on Windows with PowerShell
  • Protecting Remote Desktop (RDP) Host from Brute Force Attacks
  • How to Set a User Thumbnail Photo in Active Directory
  • Implementing Dynamic Groups in Active Directory with PowerShell
  • Match Windows Disks to VMWare VMDK Files
  • Using SSL/TLS Certificates for Remote Desktop (RDP)
  • How to View and Close Open Files on Windows Server
Footer Logo

@2014 - 2026 - Windows OS Hub. All about operating systems for sysadmins


Back To Top