need help finding Microsoft User Data folder size for all Mac Users as a report.

Not applicable

Hi All,

I am trying to pull report showing the size for all users on all Macs, their Microsoft User Data folder size.
For example: /Users/Ron/Documents/Microsoft User Data
(repeat for all users)
Is there a way to pull this kind of report using Casper Inventory. Is anyone gone through this kind of findings?
I will appreciate if anyone can help me finding the method to pull the data size (Microsoft User Data folder size).

Regards,
Vinay Washimkar

12 REPLIES 12

Not applicable

Quick & dirty way:

du -sh /Users/*/Documents/Microsoft User Data

But that won't add the results together.

tlarkin
Honored Contributor

well the casper share mounts when a script runs right? So, maybe we could do this?

#!/bin/bash

UserList=dscl . list /Users UniqueID | awk '$2 < 500 { print $1 }'

for u in $UserList ; do

results=du -sh /Users/$u/Microsoft User Data echo "$u $results" >> /Volumes/CasperShare/msuserdata.txt

done exit 0

Though I am not sure if the read only casper account executes scripts or the read/write. I assume it would be the read only...

jafuller
Contributor

Why not put this to an extension attribute and pull the report that way?
James Fuller | Technology Application Services | application developer II | V: 206.318.7153

tlarkin
Honored Contributor

oh my, hahaha I meant to do a greater than instead of less than, OK new script with extension attributes....

#!/bin/bash

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

for u in $UserList ; do

results=du -sh /Users/$u/Microsoft User Data <result>echo "$u $results" </result>

done exit 0

** I never really converted my dummy receipts to extension attributes feel free to correct me if I am wrong on this. **

karthikeyan_mac
Valued Contributor

Hi,

I have created the below extension attribute to query the size of all Users Library Preferences. When I run this as shell script it gives the size of all the users preferences, but when I add as extension attribute it gives only one users details.

*#!/bin/sh

UserList=`/bin/ls /Users | sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d' -e '/.DS_Store/d' -e '/.com.apple.timemachine.supported/d' -e '/Adobe/d' -e '/Library/d'`

for i in $UserList;
do

results=du -sh /Users/$i/Library/Preferences

echo "<result>"$i $results"</result>"

done

exit 0

Inventory Result:-
*

![external image link](attachments/0a4d110538564ccd8895be5d41c9f2c4)

sean
Valued Contributor

You are getting multiple results from your script, for example

<result>User1 28M /Users/User1/Library/Preferences</result>
<result>User2 51M /Users/User2/Library/Preferences</result>
<result>User3 1.9M /Users/User3/Library/Preferences</result>

So Casper will only see one result. You need an output as:

<result>User1 28M /Users/User1/Library/Preferences
User2 12K /Users/User2/Library/Preferences
User3 1.9M /Users/User3/Library/Preferences</result>

Try something like

#!/bin/bash

echo -n "</result>"

UserList=`/bin/ls /Users | sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d' -e '/.DS_Store/d' -e '/.com.apple.timemachine.supported/$

for i in $UserList;
do

results=du -sh /Users/$i/Library/Preferences
echo $results

done

echo "</result>"

exit 0

![external image link](attachments/96cf463221fb49df804882f4982c28c9)

jarednichols
Honored Contributor

It may be a little cleaner if you load the resulting file sizes into an
array and echo out the array between your results tags.

j
-- Jared F. Nichols
Desktop Engineer, Client Services
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436

Not applicable

Thanks for the help!

Regards,

Vinay

karthikeyan_mac
Valued Contributor

Hi,

The below Extension Attribute provides the size of Microsoft User Data Folder.

*#!/bin/sh

# Extension Attribute for displaying size of all Users Microsoft User Data Folder.

echo "<result>"

UserList=`/bin/ls /Users | sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d' -e '/.DS_Store/d' -e '/.com.apple.timemachine.supported/d' -e '/Adobe/d' -e '/Library/d'`

for user in $UserList;
do

foldersize=du -sh /Users/$user/Documents/Microsoft User Data

echo $user $foldersize

done
echo "</result>"
exit 0
*

Regards,
Karthikeyan

rmanly
Contributor III

I did not try the other one but I just whipped this up and ran Recon
and it worked.

#!/bin/bash

for user in /Users/*; do if [ -d "$user/Documents/Microsoft User Data" ]; then size=$(du -sh "$user/Documents/Microsoft User Data"); echo "<result>$size</result>"; fi
done

Good Luck!

Ryan M. Manly
Glenbrook High Schools

Not applicable

Hi,

I have created the script for finding Microsoft Users data folder size from the Users Documents folder
Here is the script I am able to execute it using command line its working fine and giving results.

But when I am coping same script in the Extension attributes as per the instruction given in the KB article http://www.jamfsoftware.com/kb/article.php?id=278.
And running inventory search, I am not able see any results.

#!/bin/bash

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

for u in $UserList ; do

results=du -sh /Users/$u/Documents/Microsoft User Data
echo "<result> $u $results </result>"

done exit 0

Please help if anyone has gone through the same problem.

Regards,
Vinay Washimkar

Date: Wed, 9 Mar 2011 21:24:01 +0530

![external image link](attachments/850906e4788d43d0852f020860feb189)

ryan_panning
New Contributor

It looks like your script will return multiple <result>'s, which I'm not sure if the JSS will like. You might want to just add the result in each 'for loop' to a string and then return the entire thing at the end. Something like:

#!/bin/bash

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

result=""

for u in $UserList ; do

results=du -sh /Users/$u/Documents/Microsoft User Data

result="$result $u $results "

done

echo "<result>$result</result>"

exit 0

~ Ryan