Is there a way to show the size of a recycle bin for each user in Windows Server 2019?
(Or, perhaps, calculate such sizes via PowerShell and then display them in a neat table?)
We may have runaway processes or applications flooding the recycle bin and consequently, the disk:
"Disk Cleanup" doesn't seem to be of much use: seems to only show the current user's recycle bin's size:
Running something like this on the target server:
(Get-ChildItem -LiteralPath 'C:\$Recycle.Bin' -File -Force -Recurse -ErrorAction SilentlyContinue |
Measure-Object -Property Length -Sum).Sum
... will get me the total size of the recycle bin but:
- does not expose ownership
- seems to take forever, in some cases > 12 hours, at which point I have to stop it as the servers run production workloads.
What is the best way to get a table where file and folder owners are displayed along with total size of files and folders they own, for all user's recycle bins on a server's C:
drive?
user directory size
--- ---
sergio recycle bin 20GB
rene recycle bin 1GB
spunky recycle bin 100GB
system recycle bin 300TB
admin recycle bin 10GB
S-1-5-18
. A table might still be of use - to confirm the SID is responsible for the bulk of Recycle Bin size across a number of servers, and potentially to automate the cleanup