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
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