$overSize = 100MB; $out = 'usage-report.txt' function inFiles($location) { echo 'Collecting information for location '+$location+'...' return ls $location -rec | ? {$_.Length -gt $overSize} } function outFiles($collection) { $collection | sort length | ft @{l="MB";e={[math]::round($_.Length/1MB)}}, @{l="Name";e={ if ($_.Name.Length -gt 37) { $_.Name.Substring(0,37 - $_.Name.Length + $_.Name.LastIndexOf('.'))+ '..'+ $_.Name.Substring($_.Name.LastIndexOf('.')) } else { $_.Name } } },directory -auto | out-file $out -width 1024 -app } $drive_c = inFiles('C:\'); $drive_d = inFiles('D:\'); $drive_e = inFiles('E:\'); $drive_f = inFiles('F:\'); echo '-- PER DRIVE --' > $out echo '`nDrive C:' >> $out outFiles($drive_c) echo '`nDrive D:' >> $out outFiles($drive_d) echo '`nDrive E:' >> $out outFiles($drive_e) echo '`nDrive F:' >> $out outFiles($drive_f) echo '`n`n-- ALL DRIVERS --' >> $out outFiles($drive_c+$drive_d+$drive_e+$drive_f) echo '`nReport completed and saved in "usage-report.txt."'