Restarting onedrive using process monitoring/ scripts

Hi I m trying to set up a Process & Service Monitor Policy that will start onedrive if the process has been stopped. but when I set it up I get a message saying “onedrive cannot be run using full administrator rights”

I get the same when I try to start the onedrive process using a script.

I am running as current user.

Is thwere a way to set up syncro to automatically restart onedrive when it has crashed/ been closed down?

I did some of the heavy lifting for this and found commands line switches and put them in this module

Or on psgallery PowerShell Gallery | Onedrive-client 0.2.2

It isn’t very polished, but you can get-odclient to tell if it is configured yet (and possibly group policy reg keys to SSO if necessary), stop-odclients and start-odclient

Unfortunately, with the Syncro backend I think you would have to just put it in a scheduled script once every X (hour?) So most of the time it should do nothing, but clutter up the script view of the asset.

Would be a prime candidate for something like Intune Proactive Remediations though

This service monitor configuration works for me on standard user accounts. The process path is %localappdata%\Microsoft\OneDrive\OneDrive.exe

1 Like

Mat,

Thank you for this suggestion.

We attempted to test this method but we ran into an issue where OneDrive was throwing an error stating it could not be run as an administrator. Is there a way to force the process to always run with user permissions and not administrative permissions?

See this blog post I found for a different platform that had the same issue I am running into: OneDrive Can't Be Run Using Full Administrator Rights | The Core Technologies Blog

I have found it a bit hit and miss and have disabled the check for some clients until I can test it more thoroughly.

However I think the issue comes down to whether the signed in user account is an administrator or not. Standard user - restarting OneDrive.exe works, runs OneDrive as that user (just tested again now on my own system where I use a Standard user account - worked perfectly). Admin user - restart .exe fails with admin error, regardless of Syncro settings (as described in the post you linked).

Office 365 has a OneDrive monitoring feature. It gives you some good information although it is not for real time use. It gives you much more detail than just whether the service is running or not.

Do you have the URL for this by chance? Or even just which portal it’s in… maybe Admin portal, reports…?

Url for monitoring is: OneDrive sync - Microsoft 365 Apps admin center

For this to work you have to grab the tenant key from: Settings - Microsoft 365 Apps admin center

And set a registry key on the devices. If you want I can share a script I created for it.

1 Like

I had forgot we set up a script to set the registry key. What we did was created a custom field for each customer in Syncro and use that to apply the key. We now have that as part of our standard scripts that run on all workstations.

Can you share your script? I am in the process of testing this.