users running OneDrive

jchin-ro
New Contributor III

How do I create a smart computer with all the computers that are running OneDrive (not just having the One Drive app installed)? Thanks.

7 REPLIES 7

hdsreid
Contributor III

I have an EA that runs a script to gather the size of the directory which will at least let you know if there is any data being synced in that folder

#!/bin/bash

loggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
DIRECTORY="/Users/$loggedInUser/OneDrive - Contoso"

size=$(du -csh "$DIRECTORY" | grep total)

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

Then you can use this data as needed....I am personally not doing anything with smartgroups with this, but i have a custom search that pumps out the size of the directory to an excel sheet on a sharepoint site. i'm only utilizing this data to report to executives who is/isn't utilizing it

mbezzo
Contributor III

Hi,
I use this EA to see if various apps are running. It looks to see if the process exists for a specific App you're interested in:

#!/bin/bash

# check for process
PROCESS=$(pgrep AppNameHere)

#see if process is running
if [[ -z "$PROCESS" ]]; then
        RESULT="Not Running"
    else
        RESULT="Running"
fi

#report results
echo "<result>${RESULT}</result>"

jchin-ro
New Contributor III

Does anyone know if the "appName" is "OneDrive" or is it "One Drive" (with a space)? I do not have it so I cannot test on my computer. Thanks.

hdsreid
Contributor III

OneDrive.app

sdagley
Esteemed Contributor II

@hdsreid One caveat on your EA to calculate the size of a OneDrive directory. I believe it will trigger downloading/hydration for any files that are cloud only and not already present on the Mac. That's probably a pretty undesirable behavior to trigger when Jamf Pro is doing a recon. EDIT - per the posts below this EA was not causing the hydration issue I blamed it for.

hdsreid
Contributor III

@sdagley I have files on demand enabled and have not run into this issue yet. My OneDrive directory has 12GB worth of content total, but only 4.8GB present on the Mac. Nothing changes during recon. Not sure if I am testing this properly, but you have me a bit concerned about this possibility

sdagley
Esteemed Contributor II

@hdsreid Thanks for that info. I hadn't actually tried this EA yet, but was responding to another thread where a Jamf recon was triggering full hydration of a user's OneDrive. I have over 500GB in OneDrive, so didn't verify my theory. It turns out the problem in the other thread was /Users had been added as a Custom Search Path for Inventory Collection, and that was triggering hydration.