none
MDT 2013 U1 - while deploy, uninstalling OneDrive - Windows 10 RRS feed

  • Question

  • How can I get rid of OneDrive in Windows 10 during a deployment of Windows 10 in MDT 2013 U1?

    I tried the known script found in different forums.

    @echo off
    cls
    
    set x86="%SYSTEMROOT%\System32\OneDriveSetup.exe"
    set x64="%SYSTEMROOT%\SysWOW64\OneDriveSetup.exe"
    
    echo Closing OneDrive process.
    echo.
    taskkill /f /im OneDrive.exe > NUL 2>&1
    ping 127.0.0.1 -n 5 > NUL 2>&1
    
    echo Uninstalling OneDrive...
    echo.
    if exist %x64% (
    %x64% /uninstall
    ) else (
    %x86% /uninstall
    )
    ping 127.0.0.1 -n 5 > NUL 2>&1
    
    echo Removing OneDrive leftovers...
    echo.
    rd "%USERPROFILE%\OneDrive" /Q /S > NUL 2>&1
    rd "C:\OneDriveTemp" /Q /S > NUL 2>&1
    rd "%LOCALAPPDATA%\Microsoft\OneDrive" /Q /S > NUL 2>&1
    rd "%PROGRAMDATA%\Microsoft OneDrive" /Q /S > NUL 2>&1 
    
    echo Removing OneDrive from the Explorer Side Panel...
    echo.
    REG DELETE "HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1
    REG DELETE "HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" /f > NUL 2>&1

    I tried to use it in the task sequence, running "cmd /c %SCRIPTROOT%\removeonedrive.cmd" after moving script to DeploymentShare\Scripts.

    Also tried to use the script as an application. I added a task to the group "PostInstall" to install this single application.

    At the end the deployment fails with a warning and OneDrive is still there. I can not see where in the logs is the reason for that. Disable the script or the application to remove OneDrive helps...

    Sincerly

    Marc

    Thursday, November 5, 2015 4:23 PM

Answers

  • There are several challenges here.

    1. Normally I would recommend calling this script during a task sequence, however due to a bug in MDT https://keithga.wordpress.com/2015/08/18/mdt-2013-uberbug03-less-logging-is-not-better/ if your script crashes, then it is difficult to debug the problems.

    2. THen I would recommend adding this as an application.

    The next challenge is to *verify* your script has been called correctly, that means adding logging into your script, perhaps somewhere at the start and near the end

    @echo Hello start script >> %temp%\MyScript.log
    ...
    @echo Hello End script >> %temp%\MyScript.log
    

    That way we know if your script was actually called correctly from MDT, or if it's a script error.


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Tuesday, November 17, 2015 9:43 PM
    Moderator

All replies

  • I don't know this script.  You could just hide with with Applocker or use group policy.

    Logs are very important. https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Mention any customizations you have made.

    Friday, November 6, 2015 10:50 PM
    Moderator
  • I don't know this script.  You could just hide with with Applocker or use group policy.

    Logs are very important. https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/ Mention any customizations you have made.

    The question is, how do I get the script working while mdt is deploying. Hiding or uninstalling Onedrive is a different discussion. OneDrive is not wanted and there are policies which do not allow OneDrive installed on a PC (even if it is hidden....)

    How can I get thist script working or how can I see whats going wrong?

    Sincerly

    Marc

    Monday, November 16, 2015 2:46 PM
  • There are several challenges here.

    1. Normally I would recommend calling this script during a task sequence, however due to a bug in MDT https://keithga.wordpress.com/2015/08/18/mdt-2013-uberbug03-less-logging-is-not-better/ if your script crashes, then it is difficult to debug the problems.

    2. THen I would recommend adding this as an application.

    The next challenge is to *verify* your script has been called correctly, that means adding logging into your script, perhaps somewhere at the start and near the end

    @echo Hello start script >> %temp%\MyScript.log
    ...
    @echo Hello End script >> %temp%\MyScript.log
    

    That way we know if your script was actually called correctly from MDT, or if it's a script error.


    Keith Garner - Principal Consultant [owner] - http://DeploymentLive.com

    Tuesday, November 17, 2015 9:43 PM
    Moderator