/build/static/layout/Breadcrumb_cap_w.png

Calculating User Folder Sizes

Our department is evaluating desktop backup solutions and we wanted a good way to estimate how much space would be required to backup all of our users's data. The K1000 reports disk space used on computers but estimating how much of that is user data vs operating system and applications is difficult. In order to get a better estimate I created two custom software inventory rules to calculate the size of C:\Users on Windows and /Users on MacOS:

Windows Rule:
ShellCommandTextReturn(powershell -Command "& {Get-ChildItem C:\Users -recurse -force -ErrorAction "SilentlyContinue" | Measure-Object -property length -sum -maximum -minimum}")
Example output:
Count : 156707
Average : 
Sum : 100229316154
Maximum : 1033927956
Minimum : 0
Property : length

MacOS Rule:
ShellCommandTextReturn(du -hd 0  /Users)
Example output:
8.0G /Users

Here is a SQL report that pulls in this data:
SELECT MACHINE.NAME, 
ROUND(DISK_SIZE, 0) as "Total Disk Available",
ROUND(DISK_USED, 0) as "Total Disk Used",
CASE 
    WHEN MACHINE.OS_NAME like 'Mac%' and MACUS.STR_FIELD_VALUE like "%G%" THEN substring_index(MACUS.STR_FIELD_VALUE, "G", 1)
WHEN MACHINE.OS_NAME like 'Mac%' and MACUS.STR_FIELD_VALUE like "%M%" THEN round(substring_index(MACUS.STR_FIELD_VALUE, "M", 1)/1000,2)
    WHEN MACHINE.OS_NAME like 'Mic%' THEN round(substring_index(substring(WINUS.STR_FIELD_VALUE, LOCATE("Sum      : ", WINUS.STR_FIELD_VALUE)+ 11), "<br/>", 1)/1000000000, 0)
END as `User Folder Size (G)`
 
FROM MACHINE
LEFT JOIN MACHINE_DISKS D on MACHINE.ID = D.ID
LEFT JOIN MACHINE_CUSTOM_INVENTORY WINUS on MACHINE.ID = WINUS.ID and WINUS.SOFTWARE_ID = 85480
LEFT JOIN MACHINE_CUSTOM_INVENTORY MACUS on MACHINE.ID = MACUS.ID AND MACUS.SOFTWARE_ID = 85481
GROUP BY MACHINE.NAME
HAVING `User Folder Size (G)` > 0
ORDER BY MACHINE.NAME
Note that since this uses custom inventory fields the Software IDs will be unique to your environment if you want to replicate this. In my case the IDs are 85480 and 85481, find those values in the SQL code above and replace them with the values from your appliance.




Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ