PowerShell Script

Find Largest Files

A safe example of the future script-detail layout: purpose, environment, copy button, usage and safety notes.

WindowsPowerShell 5.1+Read-only
ScriptTest environment: Windows 10/11 · PowerShell 5.1+Last Verified: preview only

What problem it solves

Quickly lists the largest files under a folder so an administrator can see where disk space is being used. The example only reads file metadata.

PowerShell
$Path = "C:\Users\Public\Documents"
$Top = 20

Get-ChildItem -Path $Path -File -Recurse -ErrorAction SilentlyContinue |
    Sort-Object Length -Descending |
    Select-Object -First $Top `
        @{Name="SizeMB";Expression={[math]::Round($_.Length / 1MB, 2)}},
        FullName |
    Format-Table -AutoSize

Usage

  1. Change $Path to the folder you want to inspect.
  2. Change $Top if you want more or fewer results.
  3. Run in PowerShell with access to the selected folder.
Safety note

This preview script does not delete or modify files. Production script pages will explicitly identify elevated privileges, write operations and environment-specific risks.