We had a client who wanted to know how much space each user profile was consuming on their EdgeSoft folder. We determined the path was C:\Users\{UserName}\AppData\Local\ES
and then ran this script to do the calculations:
# Get all user profiles in C:\Users
$userProfiles = Get-ChildItem -Path C:\Users
# Initialize an array to store the results
$results = @()
$totalSize = 0
foreach ($profile in $userProfiles) {
$localCachesPath = "$($profile.FullName)\AppData\Local\ES"
if (Test-Path -Path $localCachesPath) {
# Calculate the size of the Local Caches folder, excluding directories
$folderSize = (Get-ChildItem -Path $localCachesPath -Recurse -File | Measure-Object -Property Length -Sum).Sum / 1MB
# Add the result to the array
$results += [PSCustomObject]@{
Username = $profile.Name
FolderSizeMB = [math]::Round($folderSize, 2)
}
# Add to the total size
$totalSize += $folderSize
}
}
# Calculate the total number of users
$totalUsers = $results.Count
# Output the total number of users and total size
Write-Output "Total Users: $totalUsers"
Write-Output "Total Space Consumed (MB): $([math]::Round($totalSize, 2))"
# Display the results on the screen
$results | Format-Table -AutoSize
# Export the results to a CSV file
$results | Export-Csv -Path C:\Temp\UsersFolderSize.csv -NoTypeInformation
# Output the path to the CSV file
Write-Output "Results exported to C:\Temp\UsersFolderSize.csv"
If you want to find the amount of data used for a different folder, just change the \AppData\Local\ES to whatever floats your boat.
0 Comments