SOLVED

Start OneDrive when windows starts - All domain computers

%3CLINGO-SUB%20id%3D%22lingo-sub-1180404%22%20slang%3D%22en-US%22%3EStart%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1180404%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20figure%20out%20if%20there%20is%20a%20way%20we%20can%20push%20out%20a%20script%20that%20will%20enable%20the%20OneDrive%20startup%20key.%20Just%20a%20small%20background%2C%20prior%20to%20my%20time%20OneDrive%20was%20disabled%20on%20all%20computers%2C%20including%20the%20use%20of%20the%20DisableFileSyncNGSC%20key.%20Removing%20these%20keys%20doesn't%20allow%20OneDrive%20to%20start%20up%20automatically.%20So%20far%2C%20the%20only%20way%20I've%20found%20out%20how%20to%20get%20it%20to%20start%20up%2C%20is%20to%20go%20into%20the%20settings%20of%20OneDrive%20and%20click%20the%20%22Start%20OneDrive%20automatically%20when%20I%20sign%20in%20to%20Windows%22.%20This%20creates%20the%20following%20OneDrive%20registry%20key%3A%3C%2FP%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EHKEY_CURRENT_USER%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CRun%3C%2FDIV%3E%3CDIV%3EC%3A%5CUsers%5C%3CUSERNAME%3E%5CAppData%5CLocal%5CMicrosoft%5COneDrive%5COneDrive.exe%22%20%2Fbackground%3C%2FUSERNAME%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EHowever%2C%20we%20have%201%2C300%2B%20machines%20and%20it%20would%20be%20nice%20if%20there%20was%20a%20way%20to%20somehow%20push%20this%20out%20to%20everyone%20so%20they%20didn't%20need%20to%20go%20in%20and%20enable%20it%20themselves%20(since%20most%20won't%20even%20read%20the%20instructions%20to%20do%20it).%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThe%20problem%20is%2C%20creating%20a%20registry%20key%20for%20each%20unique%20user%20per%20machine%20doesn't%20quite%20work%20so%20well.%20I%20tried%20creating%20one%20like%20this%3A%3C%2FDIV%3E%3CDIV%3E%25userprofile%25%5CAppData%5CLocal%5CMicrosoft%5COneDrive%5COneDrive.exe%20%2Fbackground%2C%20but%20using%20the%20%25userprofile%25%20environment%20variable%20doesn't%20work.%20Is%20there%20anything%20I%20can%20do%20to%20force%20every%20machine%20to%20start%20OneDrive%20automatically%3F%20We%20want%20to%20use%20Known%20Folder%20Move%20for%20all%20of%20our%20users%2C%20but%20OneDrive%20has%20to%20start%20each%20time%20to%20ensure%20that%20syncing%20happens.%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1180404%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1182446%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1182446%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F377768%22%20target%3D%22_blank%22%3E%40rmoat%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Etry%20placing%20the%20key%20here%20instead%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHKEY_LOCAL_MACHINE%5CSOFTWARE%5CMicrosoft%5CWindows%5CCurrentVersion%5CRun%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethat%20should%20force%20it%20to%20run%20for%20all%20users%20on%20the%20device%20and%20you%20wont%20have%20to%20try%20and%20figure%20out%20how%20to%20inject%20into%20HKCU%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1182834%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1182834%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F55317%22%20target%3D%22_blank%22%3E%40Dustin%20Adam%3C%2FA%3E%26nbsp%3BThank%20you%2C%20that%20makes%20sense%20and%20will%20definitely%20work.%20Also%2C%20it%20just%20occurred%20to%20me%2C%20OneDrive%20can%20be%20installed%20for%20All%20Users%20by%20running%20OneDriveSetup.exe%20%2Fallusers%20%2Fsilent.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%20we%20could%20push%20that%20out%20to%20all%20computers%20as%20well%2C%20and%20the%20OneDrive%20client%20is%20then%20moved%2Finstalled%20to%20C%3A%5CProgram%20Files%20(x86)%5CMicrosoft%20OneDrive%2C%20which%20also%20makes%20updating%20run%20entries%20easier%20just%20to%20point%20at%20that%20location%20instead%20of%20the%20user%20folder.%3C%2FP%3E%3CP%3EBoth%20seem%20like%20they'll%20work%20great.%20Thanks%20for%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1183068%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1183068%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F377768%22%20target%3D%22_blank%22%3E%40rmoat%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYup%2C%20you%20can%2C%20in%20fact%2C%20if%20you%20want%2C%20here's%20the%20script%20we%20use%20when%20imaging%20computers%20(we%20use%20InTune%20and%20AutoPilot%2C%20but%20this%20will%20work%20with%20anything%20as%20it's%20just%20PowerShell)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt'll%20download%20whatever%20the%20current%20production%20release%20of%20the%20Sync%20client%20is%20and%20install%20it%20for%20all%20users%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%24%3C%2FSPAN%3E%3CSPAN%3EODClient%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3Flinkid%3D844652%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3Flinkid%3D844652%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%24%3C%2FSPAN%3E%3CSPAN%3Eoutput%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%24%3C%2FSPAN%3E%3CSPAN%3EENV%3Atemp%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN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B%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3ELaunch%26nbsp%3BOneDrive%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EStart-Sleep%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-%3C%2FSPAN%3E%3CSPAN%3ESeconds%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E5%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EUnregister-ScheduledTask%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-%3C%2FSPAN%3E%3CSPAN%3ETaskName%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3ELaunch%26nbsp%3BOneDrive%3C%2FSPAN%3E%3CSPAN%3E%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-%3C%2FSPAN%3E%3CSPAN%3EConfirm%3A%3C%2FSPAN%3E%3CSPAN%3E%24%3C%2FSPAN%3E%3CSPAN%3Efalse%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1183301%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1183301%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F55317%22%20target%3D%22_blank%22%3E%40Dustin%20Adam%3C%2FA%3E%26nbsp%3BWow%2C%20that's%20great%2C%20and%20extremely%20helpful.%20Really%20appreciate%20this.%20Thank%20you%2C%20thank%20you!%20This%20will%20help%20with%20our%20deadline%20in%20a%20month%20to%20roll%20it%20out%20to%20everyone.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1183368%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1183368%22%20slang%3D%22en-US%22%3Eno%20problem%2C%20let%20me%20know%20if%20you%20need%20anything%20else.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1233995%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1233995%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F377768%22%20target%3D%22_blank%22%3E%40rmoat%3C%2FA%3E%26nbsp%3Balso%20check%20to%20make%20sure%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22mainContainer%20%20uhf-container%20has-top-padding%20%20has-default-focus%22%3E%3CDIV%20class%3D%22columns%20has-large-gaps%20is-gapless-mobile%20%22%3E%3CDIV%20class%3D%22columns%20is-gapless-mobile%20has-large-gaps%20%22%3E%3CDIV%20class%3D%22column%20%20is-full%20is-four-fifths-desktop%20%22%3E%3CP%3E%5BHKLM%5CSOFTWARE%5CPolicies%5CMicrosoft%5COneDrive%5D%22PreventNetworkTrafficPreUserSignIn%22%20is%20NOT%20set%20to%201.%26nbsp%3B%20Setting%20it%20to%201%20will%20prevent%20OneDrive%20from%20starting%20with%20Windows%20until%20the%20user%20logs%20in%20the%20first%20time.%26nbsp%3B%20Then%20it%20should%20start%20with%20Windows%20going%20forward.%26nbsp%3B%20you%20can%20also%20read%20more%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fonedrive%2Fuse-group-policy%23PreventNetworkTraffic%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fonedrive%2Fuse-group-policy%23PreventNetworkTraffic%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1310364%22%20slang%3D%22en-US%22%3ERe%3A%20Start%20OneDrive%20when%20windows%20starts%20-%20All%20domain%20computers%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1310364%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F3175%22%20target%3D%22_blank%22%3E%40Lou%20Mickley%3C%2FA%3E%26nbsp%3BThank%20you%20also!%20I%20missed%20this%20notification.%20This%20is%20helpful%2C%20as%20we're%20going%20to%20start%20using%20Intune%20to%20do%20some%20of%20these%20OneDrive%20tasks%20now%2C%20and%20this%20was%20a%20question%20we%20had%20come%20up%20just%20yesterday.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hello,

I'm trying to figure out if there is a way we can push out a script that will enable the OneDrive startup key. Just a small background on this, prior to my time at my company, OneDrive was disabled on all computers, including the use of the DisableFileSyncNGSC key. Removing these keys doesn't allow OneDrive to start up automatically. So far, the only way I've found out how to get it to start up, is to go into the settings of OneDrive and click the "Start OneDrive automatically when I sign in to Windows". This creates the following OneDrive registry key:

 
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
C:\Users\<username>\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background
 
However, we have 1,300+ machines and it would be nice if there was a way to somehow push this out to everyone so they didn't need to go in and enable it themselves (since most won't even read the instructions to do it).
 
The problem is, creating a registry key for each unique user per machine doesn't quite work so well. I tried creating one like this:
%userprofile%\AppData\Local\Microsoft\OneDrive\OneDrive.exe /background, but using the %userprofile% environment variable doesn't work. Is there anything I can do to force every machine to start OneDrive automatically? We want to use Known Folder Move for all of our users, but OneDrive has to start each time to ensure that syncing happens.
7 Replies
Highlighted
Best Response confirmed by rmoat (Occasional Contributor)
Solution

@rmoat 

 

try placing the key here instead:

 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

 

that should force it to run for all users on the device and you wont have to try and figure out how to inject into HKCU

Highlighted

@Dustin Adam Thank you, that makes sense and will definitely work. Also, it just occurred to me, OneDrive can be installed for All Users by running OneDriveSetup.exe /allusers /silent.

 

Basically we could push that out to all computers as well, and the OneDrive client is then moved/installed to C:\Program Files (x86)\Microsoft OneDrive, which also makes updating run entries easier just to point at that location instead of the user folder.

Both seem like they'll work great. Thanks for your help!

Highlighted

@rmoat 

 

Yup, you can, in fact, if you want, here's the script we use when imaging computers (we use InTune and AutoPilot, but this will work with anything as it's just PowerShell)

 

It'll download whatever the current production release of the Sync client is and install it for all users:

 

$output = "$ENV:temp"  + '\OneDriveSetup.exe'
$apppath = "C:\Program Files (x86)\Microsoft OneDrive\OneDrive.exe"
$action = New-ScheduledTaskAction -Execute $apppath
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date)
 
Invoke-WebRequest -Uri $ODClient -OutFile $output
Start-Process -FilePath $output -ArgumentList '/allusers', '/silent'
Start-Sleep -Seconds 60

Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Launch OneDrive" | Out-Null
Start-ScheduledTask -TaskName "Launch OneDrive"
Start-Sleep -Seconds 5
Unregister-ScheduledTask -TaskName "Launch OneDrive" -Confirm:$false
}

 

Highlighted

@Dustin Adam Wow, that's great, and extremely helpful. Really appreciate this. Thank you, thank you! This will help with our deadline in a month to roll it out to everyone.

Highlighted
no problem, let me know if you need anything else.
Highlighted

@rmoat also check to make sure 

[HKLM\SOFTWARE\Policies\Microsoft\OneDrive]"PreventNetworkTrafficPreUserSignIn" is NOT set to 1.  Setting it to 1 will prevent OneDrive from starting with Windows until the user logs in the first time.  Then it should start with Windows going forward.  you can also read more here: https://docs.microsoft.com/en-us/onedrive/use-group-policy#PreventNetworkTraffic 

Highlighted

@Lou Mickley Thank you also! I missed this notification. This is helpful, as we're going to start using Intune to do some of these OneDrive tasks now, and this was a question we had come up just yesterday.