Hi @Charles Qi_MSFT - writing scripts is not the problem - the question is what commands are available that can be used in a script to get information about oneDrive.
regards
Steve
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to detect when a user is not using OneDrive or if OneDrive has issues.
I have had a number of user support issues where files could not be recovered because the user had ignored alerts from OneDrive or even logged out!
Using an MDM tool, I can remotely execute a command to determine the logged in user and then find recent files in the OneDrive folder - the initial development is using Mac / zsh:
#!/bin/zsh
loggedInUser=$(stat -f "%Su" /dev/console)
echo "Checking user: ${loggedInUser}'s OneDrive activity"
cd /Users/${loggedInUser}
cd "OneDrive - companyName"
ls -ldt -- **/*[docx,xlsx,pptx,ai,pdf,psd](D.om[1,10])
I can test the dates returned to alert if nothing is updated in the past few days.
This will work, assuming the user has OneDrive installed and set up for OneDrive for Business, the user is signed in, and there are no sync errors.
I would then run similar commands to see that ~/Desktop and ~/Documents are not being used.
This script is very basic, but functional and will really help me to detect some issues and educate the users.
Where I need help is to know how to tell if OneDrive is not logged in or has problems. I frequently find users creating file and directory names that are allowed locally but won't sync.
i.e.
cd ~/"OneDrive - companyName"
touch "this will not : sync.docx"
touch "this will not sync .docx"
touch " this will not sync.docx"
How can I use a script to report on OneDrive health?
Hi @Charles Qi_MSFT - writing scripts is not the problem - the question is what commands are available that can be used in a script to get information about oneDrive.
regards
Steve