File Explorer Slow Navigation in OneDrive
This guide explains how to resolve performance issues where File Explorer navigation becomes slow when browsing OneDrive folders.
Problem
Users experience slow response times when navigating folders within OneDrive using File Explorer. The issue is caused by insufficient permissions on the OneDrive registry key for application packages.
Solution
The fix involves granting Full Control permissions to "ALL APPLICATION PACKAGES" on the latest Microsoft OneDriveSync registry key.
Step 1: Locate the OneDrive Registry Key
- Press Win+R to open Run dialog
- Type
regeditand press Enter - Navigate to:
- Look for keys named
Microsoft.OneDriveSync_*(there may be multiple versions) - Identify the key with the latest version number (e.g.,
Microsoft.OneDriveSync_25070.413.1.0_neutral__8wekyb3d8bbwe)
Multiple Versions
If you see multiple OneDrive keys, always use the one with the highest version number as it represents the currently active installation.
Step 2: Modify Registry Permissions
- Right-click the latest OneDrive registry key
- Select Permissions
- Locate ALL APPLICATION PACKAGES in the Group or user names list
- Select ALL APPLICATION PACKAGES
- Click Advanced button
- Click Add to add a new permission entry, or select the existing entry and click Edit
- Set permissions to Full Control
- Click OK to apply changes
- Close Registry Editor
Step 3: Verify the Fix
- Open File Explorer
- Navigate to your OneDrive folders
- Confirm navigation speed has improved
PowerShell Script
Setting Permissions
Below is a PowerShell script for setting the permissions, also available on my GitHub:
<#
.SYNOPSIS
Grants Full Control permissions to the 'ALL APPLICATION PACKAGES' SID on the latest installed Microsoft OneDriveSync registry key under HKCR:\PackagedCom\Package\.
.DESCRIPTION
This script identifies the latest version of the Microsoft OneDriveSync package key within the HKEY_CLASSES_ROOT registry hive, specifically under PackagedCom\Package. It then attempts to modify the Access Control List (ACL) for this key to grant 'Full Control' permissions to the well-known SID S-1-15-2-1, which corresponds to 'ALL APPLICATION PACKAGES'. This can be useful for troubleshooting or modifying access for application packages. The script requires elevated privileges to modify registry permissions.
.NOTES
Requires elevated (Administrator) privileges.
Creates a temporary HKCR PSDrive if it doesn't exist.
Errors are written to Write-Output.
.AUTHOR
Linus Salomonsson
#>
$CurrentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$Principal = New-Object Security.Principal.WindowsPrincipal ($CurrentUser)
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue
$BasePath = 'HKCR:\PackagedCom\Package\'
$KeyFilter = 'Microsoft.OneDriveSync_*'
Write-Output "Searching for OneDrive registry keys under $($BasePath) matching '$($KeyFilter)'."
$AllKeys = Get-ChildItem -LiteralPath $BasePath -ErrorAction SilentlyContinue
if ($null -eq $AllKeys) {
Write-Output "Could not find any registry keys under $($BasePath)."
Write-Output "Please ensure the path is correct and accessible."
exit 1
}
$OneDriveKeys = $AllKeys | Where-Object { $_.PSChildName -like $KeyFilter }
if ($null -eq $OneDriveKeys) {
Write-Output "Could not find any registry keys matching '$($KeyFilter)' under $($BasePath)."
Write-Output "Please ensure OneDrive is installed correctly and the filter is accurate."
exit 1
}
Write-Output "Found $($OneDriveKeys.Count) matching key(s). Determining the latest version..."
$LatestOneDriveKey = $null
$LatestVersion = [System.Version]'0.0.0.0'
$OneDriveKeys | ForEach-Object {
$CurrentKey = $_
$KeyName = Split-Path -Path $($CurrentKey.PSPath) -Leaf
$CurrentVersion = $null
$VersionMatch = [regex]::Match($KeyName,'^Microsoft\.OneDriveSync_([\d\.]+?)_')
if ($VersionMatch.Success) {
$VersionString = $VersionMatch.Groups[1].Value
try {
if ($VersionString -match '^\d+(\.\d+)+$') {
$CurrentVersion = [System.Version]$VersionString
} else {
Write-Output "Warning: Extracted string '$($VersionString)' does not appear to be a valid version format for key: $($KeyName)"
}
} catch {
Write-Output "Warning: Could not parse version from key: $($KeyName). Error: $($_.Exception.Message)"
}
} else {
Write-Output "Warning: Could not extract version from key name: $($KeyName) using regex."
}
if ($null -ne $CurrentVersion -and $CurrentVersion -gt $LatestVersion) {
$LatestVersion = $CurrentVersion
$LatestOneDriveKey = $CurrentKey
}
}
if ($null -eq $LatestOneDriveKey) {
Write-Output "Could not determine the latest OneDrive key from the found matches."
Write-Output "This might happen if version numbers are not in the expected format in key names or no keys were found."
exit 1
}
Write-Output "The latest OneDrive registry key found is: $($LatestOneDriveKey.PSChildName)"
$TargetKeyPath = $LatestOneDriveKey.PSPath
Write-Output "Full path to the key: $($TargetKeyPath)"
$IdentityReference = New-Object System.Security.Principal.SecurityIdentifier ("S-1-15-2-1")
$RegistryRights = [System.Security.AccessControl.RegistryRights]::FullControl
$InheritanceFlags = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlags = [System.Security.AccessControl.PropagationFlags]::None
$AccessControlType = [System.Security.AccessControl.AccessControlType]::Allow
Write-Output "Attempting to grant '$($RegistryRights)' to '$($IdentityReference.Value)' on '$($TargetKeyPath)'..."
try {
$Acl = Get-Acl -Path $TargetKeyPath -ErrorAction Stop
$AccessRule = New-Object System.Security.AccessControl.RegistryAccessRule (
$IdentityReference,
$RegistryRights,
$InheritanceFlags,
$PropagationFlags,
$AccessControlType
)
$Acl.AddAccessRule($AccessRule)
Set-Acl -Path $TargetKeyPath -AclObject $Acl -ErrorAction Stop
Write-Output "Successfully applied Full Control permissions for ALL APPLICATION PACKAGES."
Write-Output "Verifying permissions..."
$UpdatedAcl = Get-Acl -Path $TargetKeyPath
$UpdatedAcl.Access | Where-Object { $_.IdentityReference -eq $IdentityReference.Value } | ForEach-Object {
Write-Output "Identity: $($_.IdentityReference), Rights: $($_.RegistryRights), Type: $($_.AccessControlType)"
}
} catch {
Write-Output "Error modifying permissions for '$($TargetKeyPath)':"
Write-Output $_.Exception.Message
exit 1
}
Administrator Required
This script must be run with elevated (Administrator) privileges to modify registry permissions.
Getting Permissions
Below is a PowerShell script for checking current permissions, also available on my GitHub:
# Check for elevated privileges (Optional, but good practice for registry modifications)
# $CurrentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
# $Principal = New-Object Security.Principal.WindowsPrincipal($CurrentUser)
# if (-not $Principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# Write-Output "This script may require elevated privileges to access HKCR. Please run as Administrator if it fails."
# # You might add logic here to restart with elevation if needed
# }
# Ensure HKCR drive is available, useful if running this multiple times or in a fresh session
# Use ErrorAction SilentlyContinue in case the drive already exists
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue
# Define the base path in HKCR where OneDrive package keys are located
$BasePath = 'HKCR:\PackagedCom\Package\'
# Define the filter pattern for OneDrive keys
$KeyFilter = 'Microsoft.OneDriveSync_*'
Write-Output "Searching for OneDrive registry keys under $($BasePath) matching '$($KeyFilter)'."
# Check if the base path exists before trying to list child items
if (Test-Path -Path $BasePath) {
# Get all child items under the base path and filter by the key pattern
# Using -LiteralPath for paths that might contain special characters, though not strictly needed here
$AllKeys = Get-ChildItem -LiteralPath $BasePath -ErrorAction SilentlyContinue
# Check if we found anything at all under the base path
if ($null -eq $AllKeys) {
Write-Output "Could not find any registry keys under $($BasePath)."
Write-Output "Please ensure the path is correct and accessible."
exit 1
}
# Now, filter these keys by name using Where-Object
$OneDriveKeys = $AllKeys | Where-Object { $_.PSChildName -like $KeyFilter }
# Check if we found any keys matching the OneDrive filter
if ($null -eq $OneDriveKeys) {
Write-Output "Could not find any registry keys matching '$($KeyFilter)' under $($BasePath)."
Write-Output "Please ensure OneDrive is installed correctly and the filter is accurate."
exit 1
}
Write-Output "Found $($OneDriveKeys.Count) matching key(s). Extracting version information..."
# --- Start: Swapped in sorting logic from latest immersive ---
$VersionInfo = $OneDriveKeys | ForEach-Object {
$KeyName = Split-Path -Path $($_.PSPath) -Leaf
# Regex to capture the version number part, assuming format like Microsoft.OneDriveSync_VERSION_...
# This regex looks for the version between "Microsoft.OneDriveSync_" and the next "_"
$VersionMatch = [regex]::Match($KeyName, "^Microsoft\.OneDriveSync_([\d\.]+)_")
if ($VersionMatch.Success) {
$VersionString = $VersionMatch.Groups[1].Value
try {
# Convert the extracted string to a [System.Version] object for accurate comparison
$Version = [System.Version]$VersionString
# Output an object containing the path and version for sorting
[PSCustomObject]@{
Path = $($_.PSPath)
Version = $Version
}
} catch {
# Handle cases where the extracted version string is not a valid Version format
Write-Output "Warning: Could not parse version from key: $($KeyName). Error: $($_.Exception.Message)"
}
} else {
Write-Output "Warning: Could not extract version from key name using regex: $($KeyName)"
}
}
if ($null -ne $VersionInfo) {
Write-Output "Sorting keys by version to find the latest..."
# Sort the collected version information objects by the Version property descending
$LatestVersionKeyObject = $VersionInfo | Sort-Object Version -Descending | Select-Object -First 1
# Define the target key path using the Path property of the sorted object
$TargetKeyPath = $LatestVersionKeyObject.Path
$LatestKeyName = Split-Path -Path $TargetKeyPath -Leaf
Write-Output "The registry key with the latest version is:"
Write-Output $($LatestKeyName)
Write-Output "Full path to the key: $($TargetKeyPath)"
# --- End: Swapped in sorting logic ---
# --- Retrieve and Filter Permissions ---
Write-Output "Retrieving ACL for $($TargetKeyPath)..."
try {
# Get the Access Control List (ACL) of the target registry key
$Acl = Get-Acl -Path $TargetKeyPath -ErrorAction Stop
# Filter the access rules to find those related to "APPLICATION PACKAGE*"
$AclOutput = $Acl.Access | Where-Object {$_.IdentityReference -like "APPLICATION PACKAGE*" -or $_.IdentityReference -like "PROGRAMPAKETUTFÄRDARE*"}
Write-Output "ACL entries for identities matching 'APPLICATION PACKAGE*':"
if ($null -ne $AclOutput) {
Write-Output $AclOutput
} else {
Write-Output "No ACL entries found matching 'APPLICATION PACKAGE*' for this key."
}
} catch {
# Catch any errors that occurred during the Get-Acl process
Write-Output "Error retrieving or filtering ACL for '$($TargetKeyPath)':"
Write-Output $_.Exception.Message
# Exit with an error code
exit 1
}
} else {
Write-Output "No valid OneDrive Sync version keys found after parsing."
# Exit with an error code
exit 1
}
} else {
Write-Output "Registry path $($BasePath) does not exist on this device."
Write-Output "Please ensure OneDrive is installed correctly."
# Exit with an error code
exit 1
}