@Echo off
@echo OneDrive is initiating, please wait while we setup onedrive for the first time on this computer.
IF EXIST %USERPROFILE%\onedrivesetup.txt (goto End) else (Goto Start)
:start
IF EXIST %localappdata%\Microsoft\OneDrive\Update\OneDriveSetup.exe (goto scriptstart) else (Goto start)
:scriptstart
@echo Waiting 20 seconds for Onedrive to initiate
START \\Appsserver\files$\onedrive\odl2.exe
timeout 12 /nobreak
%localappdata%\Microsoft\OneDrive\Update\OneDriveSetup.exe
REM - Enable Modern Authentication
reg add HKCU\Software\Microsoft\OneDrive /v EnableADAL /t REG_DWORD /d 1 /f
"%localappdata%\Microsoft\OneDrive\OneDrive.exe"
Rem - Create Completion File
echo.>"%USERPROFILE%\onedrivesetup.txt"
@echo Onedrive should now be setup for use.
START \\Appsserver\files$\onedrive\odl3.exe
timeout 5
exit
:End
Exit