Open in the explorer

Set the default location for the OneDrive folder

Type
User
GPO path
User Configuration › Policies › Administrative Templates › OneDrive
Supported on
At least Windows Server 2008 R2 or Windows 7
ADMX file
OneDrive.admx
Internal name
OneDrive/DefaultRootDir

Explanation

This setting lets you set a specific path as the default location of the OneDrive folder on users' computers. By default, the path is under %userprofile%.

If you enable this setting, the default location of the OneDrive - {organization name} folder will be the path that you specify in the OneDrive.admx file. To prevent users from changing the location you specify, enable the "Prevent users from changing the location of their OneDrive folder" setting.

If you disable or do not configure this setting, the default location of the OneDrive - {organization name} folder will be in %userprofile%.

Registry

HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\OneDrive
Value name
DefaultRootDir
StateValue written
Enablednot defined in the ADMX (see the options below)
Disablednot defined in the ADMX (see the options below)

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

The ADMX does not specify the value written when enabled; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled). The commands below use 1/0 as an assumption.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: OneDrive/DefaultRootDir
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\OneDrive'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'DefaultRootDir' -Value 1 -Type DWord  # assumed value (not defined in the ADMX)
$k = 'HKCU:\Software\Policies\Microsoft\OneDrive\DefaultRootDir'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Path
$items = @{
    '<name1>' = '<value1>'
    '<name2>' = '<value2>'
}  # Replace the values with your own
$items.GetEnumerator() | ForEach-Object { Set-ItemProperty -Path $k -Name $_.Key -Value $_.Value -Type ExpandString }

Disable

# Disable: OneDrive/DefaultRootDir
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\OneDrive'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'DefaultRootDir' -Value 0 -Type DWord  # assumed value (not defined in the ADMX)

Revert to "Not configured"

# Revert to "Not configured": OneDrive/DefaultRootDir
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\OneDrive'
Remove-ItemProperty -Path $k -Name 'DefaultRootDir' -ErrorAction SilentlyContinue
$k = 'HKCU:\Software\Policies\Microsoft\OneDrive\DefaultRootDir'
Remove-Item -Path $k -Recurse -Force -ErrorAction SilentlyContinue

Options (1)

LabelControlRegistry valueREG typeConstraints / details
Path:DefaultRootDirListList (table)listSoftware\Policies\Microsoft\OneDrive\DefaultRootDirName = value pairs · additiveREG_EXPAND_SZ (values under the key)

Application

Microsoft OneDrive (Microsoft) — October 2026 templates

October 2026 templates from pl4nty/web-admx-tool.