Testing 2

Blog Article (Testing)

I’m unsure if its just me, or other people are having the same issue of OneDrive for Business not ‘provisioning’ until around 3 minutes after first logon. I tried it with and without the system apps on W10-1809 and it didn’t seem to make much difference, onedrive would take around 3-4 minutes to install (per user) on first logon. Subsequent logons are fine, its just the very first logon that seems to take an age.

There doesn’t seem to be any indication that OneDrive is actually doing anything to the end user, and the ‘OneDrive’ folder in Explorer displays, but doesn’t contain any files. This can be a big pain in schools, especially with shared workstations.

Once OneDrive installs, the icon was greyed out (offline), users would have to manually Right Click > Settings > Account > Add Account before their files would sync.

I haven’t yet found a way to speed up this process, so instead I’ve put together a small batch script that will do the following;

  1. First Check if the setup had already run before, if so terminate
  2. Check to see if OneDrive.exe exists, if not keep checking
  3. Once provisioned, wait 12 seconds to ensure its fully provisioned
  4. Run first time setup (OneDriveSetup.exe)
  5. Enable Modern Authentication
  6. Open Onedrive Folder (OneDrive.exe)
  7. Create ‘Completion’ file for step 1 to check against

The Foundations

In order for this to work i will assume you already have Azure SSO setup, (I was in the process of writing an article but got sidetracked, i’ll update the article here once i get a minute) and that you have a valid O365 subscription.

You will need to enable the following in GPO’s.

Computer Config > Policies > Admin Templates > Onedrive > Silently configure OneDrive using the primary Windows account – Enabled

Computer Config > Policies > Admin Templates > Onedrive > Enable Onedrive Files-On-Demand (Okay not needed but why wouldnt you?)

Running the Script

The Batch script can be run manually but makes sense to add this as a logon script. The script can be copied from below. At the end of the script it will create a blank file in their %USERPROFILE% folder and check against it to ensure it doesn’t run again.

@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 12 seconds for Onedrive to initiate
timeout 12 /nobreak
Rem - Run First Time Setup
%localappdata%\Microsoft\OneDrive\Update\OneDriveSetup.exe
Rem - Enable Modern Authentication
reg add HKCU\Software\Microsoft\OneDrive /v EnableADAL /t REG_DWORD /d 1 /f
Rem - Launch Onedrive Folder
"%localappdata%\Microsoft\OneDrive\OneDrive.exe"
Rem - Create Completion File
echo.>"%USERPROFILE%\onedrivesetup.txt"
@echo Onedrive should now be setup for use.
timeout 5
exit
:End

GUI Version

If like me you don’t like the idea of a batch window being open on the users screen for a few mins while Onedrive installs, this may be the best option for you. I have written a small program in VB which will call the .Bat file silently and provide a progress bar to the end user so at least they see “something” happening.

The video below is a recording of the program in action. Apologies for the rubbish quality as it was recorded using a free screen-recorder focusing on a RDP session. The account i used was a temporary account with no files in OneDrive, had this been an active account there would be some files to show.

Before we continue, i must stress this probably wont be the best way to do it, there may be even easier options out there but its a quick fix to a problem i had, it works for me, if it also helps you then great. The code probably could be tidied up a little but as i said, its a quick fix and it works.

I have used Visual Basic 2010 express, purely because i’ve had it for years and i understand it a bit more than other languages.

You can download here > https://visualstudio.microsoft.com/vs/older-downloads/ (you might need to create a free account).

The program will run in 3 parts (as exe’s), and display a progress-bar which is triggered by certain parts of the batch script. ( I didn’t have the time or knowledge to convert the batch commands into VB commands so i opted for this option).

The process works like this

  1. Run the first program at logon (ODL.exe)
  2. The program checks to see if the ‘completion file’ exists, if so it terminates, if not it runs the batch script
  3. The script runs in the background, when Onedrive has provisioned, it launches the second part (ODL2.exe) and terminates the first window.
  4. Progress bar increments to 80% while the script continues to run in the background
  5. Once script is complete, the progress box closes and displays a message from the third part ODL3.exe to alert the user that one-drive is fully set up.

The Setup

I will provide all the source files below needed to edit this program, it is all set up, the only section you need to change is the directory to which thesetup files will be stored (the .EXE’s & batch script) which i will show you below. To start you need to create a directory which is accessible to your users, for example \\Appsserver\files$\onedrive. In here you will store your batch file and your .EXE files which i will explain how to create below.

The Batch File

This is slightly different to the one posted further up, the only difference is the code to call the .EXE file. You will need to edit this to your preferred storage location e.g. \\Appsserver\files$\onedrive and place in the directory you created above

@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

The GUI (.EXE files)

To create the 3 .EXE files shown above you will first need to change the location of your batch file & compile your program for it to work. I will provide you with the compiled ODL2.exe and ODL3.exe files as they do not require any modification, but you’ll probably want to comile it yourself so you can be sure of the codes integrity and see exactly what the code is doing.

You do not need to make any other changes but the source code is there if you want to make any improvements or changes.

The first step is to install Visual Basic 2010 Express as detailed earlier in the article and run it for the first time.

Now you should download the source files from here > https://files.anme.co.uk/blog/20190214-OneDriveSourceFiles.zip

Place the 3 files into the ‘Projects’ folder located at Local User > Documents > Visual basic 2010 > Projects

Open up Visual Basic 2010 and click ‘open project’ & browse to Local User\Documents\Visual Studio 2010\Projects\OneDrive Setup Launcher\Onedrive Setup Launcher, Choose the onedrive setup launcher.vbproj file

On the right hand pane in ‘Solution explorer’, right click ‘Form1.vb’ and chose View Code

The code viewer will appear, you can now change your location of your batch file

Change to location to suit you and go to File > Save all

You can now press the green play icon or press F5 to start debugging.

The program will run, and try to run the batch file at the specified location. Once you are happy you can grab the updated .EXE file from Documents\Visual Studio 2010\Projects\Onedrive Setup Launcher\Onedrive Setup Launcher\bin\Debug

Copy this to your directory you created in Step one (e.g.  \\Appsserver\files$\onedrive).

You can either use the ODL2.exe and ODL3.exe i have provided in the zip file, or repeat the above steps for the remaining two folders in order to generate your own .EXE files, these don’t need any modification to any of the code.

Note: It is important to update your batch file with the correct path to the .EXE files, and ensure they are in the location.

You can run ODL.exe at logon using the following GPO

Computer Config > Admin Templates > System/Logon > Run these programs at Logon

Liam Robinson
ANME Member

 

Disclaimer:

The information which is summarised herein does not constitute technical or other professional advice and is general in nature. It does not take into account your specific circumstances and should not be acted on without full understanding of your current situation by your Network Manager. In doing so you risk implementing changes that may not be suitable to your needs.

Whilst we have tried to ensure the accuracy and completeness of the contents of this website, ANME Limited cannot offer any undertaking or guarantee, either expressly or implicitly, including liability towards third parties, regarding how correct, complete or up to date the contents of this website are. We reserve the right to supplement this website at any time or to change or delete any information contained or views expressed on this website.

ANME Limited accepts no liability for any issues, loss or damage howsoever arising out of the use of this website or reliance on the content of the website.


Testimonials from Members & Partners

  • “Fantastic event, with interesting content and very well organised.”

    Alain Squiteri, Sales Director - InVentry

  • I thought the day was excellent. It was really good to have the companies there and invaluable for meeting and speaking with new contacts. I really hope this carries on as it was desperately needed in our field.

    Janet Cannell, Member

  • We’re really proud to be ANME’s platinum sponsor. It’s such a great platform for school network managers to get together and share ideas, plus it provides us the opportunity to speak directly to schools using our solutions and get their feedback and input into new features. Every event is always different, with fantastic speakers providing real insight and ideas on all things edtech.

    Al Kingsley, Group Managing Director, NetSupport Limited

  • ANME meetings provide valuable networking - being able to talk to other professionals doing the same role and understanding their approach and their context. This is a great way to challenge what you are doing in your own setting.

    Neil Limbrick, ANME Ambassador

  • A fantastic online resource of like-minded professionals that you can use to bounce ideas off, chat things through, get advice from. Invaluable.

    Ric Turner, Balshaws Church of England High School

  • The ANME is a priceless resource for anyone working in an IT support role in the education sector. The online forum is lively and informative and the regular meetings provide insight into new products and valuable networking opportunities with peers from other establishments. I've lost count of the number of valuable conversations and helpful tips that I've had since becoming a member. If you've not been to a meeting before then try to attend the next one in your area, you won't be disappointed.

    Dave Leonard, ANME Ambassador and ICT Manager at Matthew Moss High School

  • The ANME has been a great resource when you're a lone IT manager, now you have friends going through the same obstacles as you, with plenty of advice and guidance.

    Michael Frost, ANME Member & IT Network Manager at Parkwood Hall Co-operative Academy

  • Being part of the ANME is like being part of a large corporate IT department, there's always someone you can ask for advice

    Paul Gillon, ANME Member & Network Manager at West Hill School, Stalybridge

  • ANME is like having a team of IT experts at my fingertips. It helps me keep up to date with the latest trends in IT education.
    Rick and the ANME members have always helped when I've needed extra guidance to make great IT decisions

    Clifford Fernandes, ANME Member & IT Manager at Claremont High School

  • I attended my first ANME regional meeting recently which was great. It was Informative, relevant and useful! Unlike some meetings I attend where you get one or two useful nuggets of information, but other bits have been added to the agenda as fillers. Glad to be a member of this group of like-minded individuals.

    Adam Hall, ANME Member & IT Operations Manager at Four Oaks Learning Trust