Custom Report to collect User Information

aateran
New Contributor

Greetings all;

I am looking/needing a report to go against the JSS that will report back the users on mac's and the size of their home directories. If anyone has created one and is willing to share it would help from reinventing the wheel.

9 REPLIES 9

bentoms
Release Candidate Programs Tester

Would like this too.

colonelpanic
Contributor
#!/bin/bash

cd /users/
alias=`ls | grep [0-9a-z][0-9a-z][0-9a-z] | grep -v "_spotlight" | grep -v "root" | grep -v "_" | grep -v "shared" | grep -v "Shared" | grep -v ".localized"`
cd /users/"$alias"/
hdsize=`du -h -s /users/"$alias"/ | awk {'print $1'}`

echo "$hdsize"
exit 0

this is an old script I wrote when I first started scripting so it probably could be better, but this will echo out the home directory size. you can return the variable in an extension attribute, then create a search that displays the result of the extension attribute and that should hopefully do the trick

SeanA
Contributor III

In another thread started by donmontalvo, there is a discussion about creating an Extension Attribute for Outlook 2011 identities folder size. I bet that you can use that information to help you with your request.

http://jamfnation.jamfsoftware.com/discussion.html?id=3970

jhbush
Valued Contributor II

This may need cleaned up, but it's based off of Don's script.

#!/bin/bash

echo "<result>"

UserList=`dscl . list /Users UniqueID | awk '$2 > 501 { print $1 }'` 

for u in $UserList ; 
do
if [ -d /Users/$u/ ]; then
results=`du -sh /Users/$u/ | grep -v "[Back" | grep -v ".plist" | awk '{print $1}'`
else continue
fi
echo $u $results

done
echo "</result>"
exit 0

Joel_Peasley
Contributor
Contributor

Thanks for posting that script Jason. It looks like we are just missing a in the du -sh command.

du -sh /Users/$u/ | grep -v "[Back" | grep -v ".plist" | awk '{print $1}'`

Other than that your script worked great.

Thanks,
Joel

donmontalvo
Esteemed Contributor III

@Joel.Peasley I just went back and added a second slash to the line since it looks like some slashes aren't showing up when posted the way they show up in the Edit window (to precede a left bracket with a backslash, need to add a second backslash). :(

So there's two issues with the Edit window...(1) all quoted text getting BOLDED, and (2) backslash needing to be escaped with a backslash.

This line should be bolded This line should not be bolded

XL t-shirt please. :b

Don

--
https://donmontalvo.com

mm2270
Legendary Contributor III

There's already a FR from rmanly on that issue:
https://jamfnation.jamfsoftware.com/featureRequest.html?id=799

donmontalvo
Esteemed Contributor III

@mm2270 There goes my XL t-shirt. :.(

<tongue in cheek>

--
https://donmontalvo.com

aateran
New Contributor

Thank You for the responses will try this out.