October 2021
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Please see steps below to deploy the OneDrive App to your devices on a ‘Per machine‘ basis and for ‘All users‘ of the device. I have created a .bat file to do this.

You can then manipulate the script to integrate with WDS/MDT or SCCM, it can even be deployed using Group Policy as a start up script.

.BAT file code:

@echo off
IF NOT EXIST "C:\Program Files\OneDriveHasBeenInstalled.txt" GOTO INSTALL
exit /b 0

:INSTALL
pushd \\domain\share\Apps\32-bit\OneDrive
OneDriveSetup.exe /allusers
Popd

@ECHO OFF
copy "\\domain\share\Apps\32-bit\OneDrive\OneDriveHasBeenInstalled.txt" "C:\Program Files\OneDriveHasBeenInstalled.txt"

The script first checks whether a file exists within the C:\Program Files folder – This is used as the detection method.

If the .txt file exists it will exit and not proceed.

If it’s not installed it will go to :INSTALL and install OneDrive.

Once installation has been completed it will copy a file to the C:\Program Files folder to use as the detection method so that it does not reinstall the software when the device is restarted.

SCCM Method:

IF NOT EXIST "C:\Program Files\OneDriveHasBeenInstalled v20.124.0621.0006.txt" (
"%~dp0OneDriveSetup.exe" /AllUsers


echo %date% %time% OneDriveHasBeenInstalled v20.124.0621.0006.txt Setup executed and ended with error code %errorlevel%. >> "C:\Program Files\OneDriveHasBeenInstalled v20.124.0621.0006.txt"
)

The SCCM method is a little different. I used the .BAT script above as the ‘Installation Program’ when creating the application and used the txt file as the detection method.

The SCCM script shown is a bit more effective as it pushes useful information into the text file such as Date/Time/Errors.

It doesn’t use the ‘Copy’ command which is probably a bit more effective too.