Forum Discussion
OneDrive sync client /silentConfig (17.3.6943.0625)
Spotted the /silentConfig switch has made it into the sync client production ring for version 17.3.6943.0625.
Does anyone have any info on it's usage yet? Or at least a nod if it's still a preview feature being worked on?
From initial poking around, I've been able to pre-load some basic registry and throw the /silentConfig switch together with /configure_business which then skips through the prompt for email details and goes straight to the folder selection screen; but would be useful to see someone else confirm the findings, and whether this is likely to stay.
Some example PS I'm testing with (n.b. using -Force will nuke any existing config - you've been warned; assumptions made re: mail address - feel free to use upn instead):
#requires -version 4 param([switch]$Force=$false,[string]$TenantID="00000000-1111-2222-3333-000000000000") # Configure your tenant ID and default reg path here $businessTenant=$TenantID $businessRegPath="HKCU:\Software\Microsoft\OneDrive\Accounts\Business1" if (Test-Path "$($env:LocalAppData)\Microsoft\OneDrive\OneDrive.exe") { Get-ChildItem "$($env:LocalAppData)\Microsoft\OneDrive\OneDrive.exe" | % { if ($_.VersionInfo.ProductVersion -ge [version]"17.3.6943.0") { "Configuring OneDrive $($_.VersionInfo.ProductVersion)" # Grab email address from current user's DS object (or manually set) Add-Type -AssemblyName System.DirectoryServices.AccountManagement | Out-Null $businessEmail=[System.DirectoryServices.AccountManagement.UserPrincipal]::Current.EmailAddress # Determine if OneDrive has already been set up and kill unless -Force switch is being used if ($(Test-Path $businessRegPath)) { if ($Force) { Remove-Item -Path $businessRegPath -Recurse -Force -ErrorAction SilentlyContinue | Out-Null } else { "OneDrive.exe registry configuration already exists, use -Force switch to overwrite" break } } if ($(Test-Path "$($env:LocalAppData)\Microsoft\OneDrive\settings\business1\global.ini")) { Get-Content "$($env:LocalAppData)\Microsoft\OneDrive\settings\business1\global.ini" | ? {$_ -match "cid|c.i.d"} | % { if ($($_ -replace "\0") -match "cid\s=\s$") { $NotConfigured = $true } } if ($Force -or $NotConfigured) { Remove-Item -Path "$($env:LocalAppData)\Microsoft\OneDrive\settings\business1" -Force -Recurse -ErrorAction SilentlyContinue | Out-Null } else { "OneDrive.exe configuration already exists, use -Force switch to overwrite" break } } Start-Sleep -Seconds 2 # Configure registry defaults New-Item -Path $businessRegPath | Out-Null New-ItemProperty -Path $businessRegPath -Name "Business" -PropertyType Dword -Value 1 -Force | Out-Null New-ItemProperty -Path $businessRegPath -Name "ConfiguredtenantId" -PropertyType String -Value "$($businessTenant)" -Force | Out-Null New-ItemProperty -Path $businessRegPath -Name "FirstRun" -PropertyType Dword -Value 1 -Force | Out-Null New-ItemProperty -Path $businessRegPath -Name "UserEmail" -PropertyType String -Value "$($businessEmail)" -Force | Out-Null Start-Sleep -Seconds 2 # Run OD exe with arguments $businessArgs = "/background /configure_business:$($businessTenant) /silentConfig" Start-Process "$($env:LocalAppData)\Microsoft\OneDrive\OneDrive.exe" -ArgumentList $businessArgs } else { "OneDrive.exe version must be newer than 17.3.6943.0" } } }
- Louis SimonettiIron Contributor
This is pretty smart. Thanks!
- Avian 1Iron Contributor
Like the idea.
It seems to be working for me as normal user, but when I run as admin user I am getting following error
"OneDrive cant be run using full administrator rights"
My UAC is also turned off, but still getting same error? Any idea thow handle this?
Secondly Is there any way to skip rest of the steps of Wizard?
Avian