Menu
CCMEXEC.COM – Enterprise Mobility
  • Home
  • General
  • Configuration Manager
  • Windows 10
  • Intune
  • GitHub
  • Windows 11
  • About the author
CCMEXEC.COM – Enterprise Mobility

Remove the Onedrive Setup during OSD in Windows 10

Posted on November 5, 2015November 5, 2015 by Jörgen Nilsson

In Windows 10 Onedrive is builtin, in some scenarios you don’t want to use it as, for instance if you use both Onedrive and Onedrive for Business installed as that is confusing for the user. Yes, you can turn of Onedrive using a Group Policy but the Onedrive Setup will run for every user creating a profile on the system anyway. In many scenarios we don’t want it to run at all.

Onedrive

How does this work then? In the default user profile there is a Run Command in the registry the runs for every user creating logging on to the computer.

OnedriveSetup1

What we use is the old trick in the book, to mount the default user profile during OS Deployment and simply delete the Run command from the registry then it will not execute at all for any user. We create a .cmd file with the following command lines to first mount the default user registry, remove the command and unmount it.

RemoveOnedriveCMD

The .cmd file can be downloaded here: removeOnedrive.cmd

To implement it:

1. Download the file and copy it to a folder that you can use as a package Source for a package in Configuration Manager.

2. Rename the file to “RemoveOneDrive.cmd”

3. In Configuration Manager create a new package with the newly created folder as the source folder.
RemoveOneDrivePackage

5. Then we distribute the content if you haven’t automated it already like I do 😉 :https://ccmexec.com/2015/08/powershell-automatically-copy-packages-to-dp-in-configuration-manager-2012/

6. Add a step to the Task Sequence to run the command, I like to use the Run Command Line step but you could create a program as well if you like. Note: It has to run after a reboot to the full OS, it cannot be run in WinPE.
RemoveOnedriveTS Then you are ready to test the deployment.

  • Configuration Manager
  • OneDrive
  • OS Deployment
  • Windows 10
  • 4 thoughts on “Remove the Onedrive Setup during OSD in Windows 10”

    1. Pingback: » Remove the Onedrive Setup during OSD in Windows 10Klient.nu
    2. Mike says:
      April 1, 2016 at 11:04 pm

      Hello , thanks for this but i was just curious can you run this in a inplace upgrade task sequence as well ?
      Thanks
      Mike

      Reply
    3. John Caviani says:
      December 19, 2016 at 9:10 pm

      This script had been working nicely until I made the latest updates in v1607. I now get a error in my task sequence for this step.

      Reply
    4. Richard says:
      February 13, 2019 at 1:48 am

      Added the following line to the batch file to remove Onedrive shortcut from Start Menu:

      del “C:\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\onedrive.lnk”

      Reply

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

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

    My name is Jörgen Nilsson and I work as a Senior Consultant at Onevinn in Malmö, Sweden. This is my blog where I will share tips and stuff for my own and everyone elses use on Enterprise Mobility and Windows related topics.
    All code is provided "AS-IS" with no warranties.

    Tweets by ccmexec

    Recent Posts

    • Windows Servicing, Personal Teams and Success.cmd
    • Windows MDM Security Baseline – Settings Catalog
    • Configuring MS Edge Security Baseline v107 using Settings Catalog
    • Configuring Desktop App Installer using CSP and script?!
    • Customizing Taskbar and Start in Windows 11 22h2 with PowerShell

    ©2023 CCMEXEC.COM – Enterprise Mobility | WordPress Theme by Superb Themes
    This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.Accept Reject Read More
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    SAVE & ACCEPT