Convert OneDrive to per-machine installation

Posted by

I recently updated my Update-OneDrive.ps1 script on GitHub to update to the latest OneDrive version and convert current installation to per-machine installation. Have a look and any feedback and contributions are welcome!

This script will take care about your current running machines and can be deployed by PowerShell script or win32-application.

Implementation with Intune Win32 app

Start by creating Win32-app in Intune portal, select the intunewin app and press ok


Enter name, Description, Publisher, Category


Now time for some install commands, write the following

Install command: PowerShell.exe -ExecutionPolicy RemoteSigned -WindowStyle Hidden -NoLogo -File .\Update-OneDrive.ps1

Uninstall command: cmd /c

Install behavior: User


And some requirements


The detection rules might look like this, this makes sure one user per machine runs the application

Path: %ProgramFiles(x86)%\Microsoft OneDrive

File or folder: OneDrive.exe

Detection method: File or folder exists


and press Add to save and upload the application, wait until the application has been uploaded and Assign the application to a group


Troubleshooting and logging

Make sure you deployed the application to user

The script will do some logging in the %Temp% folder, called AutomateOneDrive.log

Make sure when entering the install command, the PowerShell arguments is in the correct order, if -ExecutionPolicy is after -File it will not work and the application installation will fail


References and other posts

Ingest OneDrive group policies manage settings in an awesome Intune way


  1. Do you still need to remove the default ‘OnDriveSetup.exe /thefirstsetup’ from the default user profile?


  2. Cool script. Per also wrote a script for this but not as intelligent. Only thing about your setup that worries me is, what if user is not local admin (cause you deploy it to users).


    1. Hi! Thanks for commenting. If you use the Win32 I should work. I have some thoughts about handle that scenario as well but I run into some trouble when I had later version on my machine that I downloaded..


    2. Thanks for your reply sir 🙂 Going to test it out at customer. Deploy it as win32 to user without admin rights! Keep up the great blogs.

      Liked by 1 person

    3. actually, the script is written in a way if you happen to run as System, it will try to download the latest version and execute with allusers parameter. Cannot garantuee it works but the code is there – Test and come back 🙂
      as long as there are no later version installed on the machine it should work


Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.