Upon testing out our latest build of Windows 11 I’ve identified an issue with the latest July Cumulative Update (2024-07 Cumulative Update for Windows 11 Version 23H2 for x64-based Systems (KB5040442)) and the latest OneDrive client.
The Problem
The latest update causes windows to think ‘cloud files’ are actually downloaded to the device, causing disk space to become full very quickly. Despite having Files on Demand switched on, the OS still thinks each file has been downloaded when in reality its still cloud only. This will become a big problem if multiple users are logging onto the same PC’s as their entire OneDrive libraries will be synced locally (or at least windows will think it is).
Testing
************
Update 12/08/2024
After a teams call with Microsoft showing the issue they confirmed their is a problem but not quite sure with what yet. Upon further testing I completely removed OneDrive from the affected PC’s and re-installed from the Microsoft website (OneDrive release notes – Microsoft Support) This appeared to fix the issue, despite being the exact same release as before. I have added an updated script below to automate uninstalling and re-installing from the Microsoft Website. (No Winget)
************
************
Update 15/08/2024
After another call with Microsoft, they have confirmed it is an issue with the July Update not the Onedrive Client and that they are working on a fix for it, but no ETA. I’ve installed the 2024-08 update but the issue still persists. My workaround fix also works for the August update.
************
Upon testing I had two identical PC’s one with the July update and one without. the latter was working as expected, the former had the bug/issue.
Working
OS Build: 22631.2861
OneDrive Build: 24.151.0728.0003
Not Working
OS Build: 22631.3880
OneDrive Build: 24.146.0721.0003
It appears when a device has the July 24 update, the OneDrive client is changed to 24.146.0721.0003 which I believe is causing the problem.
The Solution / Workaround
I’ve reported the issue to Microsoft so hopefully a fix is implemented soon, however the fix/workaround i have found is to upgrade the OneDrive client. I’ve have created a script below which does the following;
- Uninstalls OneDrive Client (instantly frees up the space)
- Installs latest version of OneDrive using winget (24.151.0728.003)
- Runs Onedrive
- Run GPUpdate
- Prompts user for reboot
Updated Script (Without Winget) – Change the “$ReleaseVer” variable to the release you wish to install
## Copyright 2024 - Liam-Robinson.co.uk ##
# PowerShell Script to Completely Remove OneDrive and Re-Install it from a Microsoft Website
#Change this Release number to the FULL current release number on here https://support.microsoft.com/en-us/office/onedrive-release-notes-845dcf18-f921-435e-bf28-4e24b95e5fc0?ui=en-us&rs=en-gb&ad=gb
$ReleaseVer = "24.151.0728.0003"
# Step 1: Completely Remove OneDrive from the System
# Stop OneDrive if it is running
Write-Output "Stopping OneDrive process if running..."
Stop-Process -Name "OneDrive" -ErrorAction SilentlyContinue
# Uninstall OneDrive for the current user
Write-Output "Uninstalling OneDrive for the current user..."
$OneDrivePath = "$env:SystemRoot\SysWOW64\OneDriveSetup.exe"
if (Test-Path $OneDrivePath) {
Start-Process $OneDrivePath "/uninstall /Allusers" -NoNewWindow -Wait
} else {
$OneDrivePath = "$env:SystemRoot\System32\OneDriveSetup.exe"
if (Test-Path $OneDrivePath) {
Start-Process $OneDrivePath "/uninstall /Allusers" -NoNewWindow -Wait
} else {
Write-Output "OneDriveSetup.exe not found."
}
}
# Remove leftover files and directories
Write-Output "Removing OneDrive leftover files and directories..."
Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\AppData\Local\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:USERPROFILE\AppData\Roaming\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
# Remove OneDrive from Registry
Write-Output "Removing OneDrive registry entries..."
Remove-Item "HKCU:\Software\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "HKCU:\Software\Microsoft\Office\16.0\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "HKLM:\SOFTWARE\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive" -Recurse -Force -ErrorAction SilentlyContinue
# Clean up the OneDrive scheduled tasks
Write-Output "Cleaning up OneDrive scheduled tasks..."
Get-ScheduledTask | Where-Object {$_.TaskName -like "*OneDrive*"} | Unregister-ScheduledTask -Confirm:$false
# Step 2: Install OneDrive from the OneDrive release page
# Set the download link
$OneDriveInstallerURL = "https://oneclient.sfx.ms/Win/Installers/$ReleaseVer/amd64/OneDriveSetup.exe"
# Set the download path
$InstallerPath = "$env:TEMP\OneDriveSetup.exe"
# Download the installer
Write-Output "Downloading OneDrive installer..."
try {
Invoke-WebRequest -Uri $OneDriveInstallerURL -OutFile $InstallerPath -ErrorAction Stop
Write-Output "OneDrive installer downloaded successfully."
} catch {
Write-Output "Failed to download OneDrive installer. Exiting script."
Exit 1
}
# Install OneDrive with a timeout (e.g., 300 seconds)
Write-Output "Installing OneDrive..."
$timeout = 300 # seconds
$sw = [System.Diagnostics.Stopwatch]::StartNew()
try {
$process = Start-Process -FilePath $InstallerPath -ArgumentList "/allusers" -NoNewWindow -PassThru
while (!$process.HasExited -and $sw.Elapsed.TotalSeconds -lt $timeout) {
Start-Sleep -Seconds 5
}
if (!$process.HasExited) {
Write-Output "OneDrive installation is taking too long. Killing the process..."
$process.Kill()
Exit 1
}
Write-Output "OneDrive installation completed."
} catch {
Write-Output "OneDrive installation failed to start or complete. Exiting script."
Exit 1
}
# Wait to ensure installation completes
Start-Sleep -Seconds 20
# Step 3: Check if OneDrive is Installed and Launch
# Possible locations for OneDrive executable
$PossiblePaths = @(
"$env:ProgramFiles\Microsoft OneDrive\OneDrive.exe",
"$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe",
"$env:ProgramFiles(x86)\Microsoft OneDrive\OneDrive.exe"
)
# Attempt to find and launch OneDrive
$OneDriveExecutable = $PossiblePaths | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($OneDriveExecutable) {
Write-Output "OneDrive installed successfully. Launching OneDrive..."
try {
Start-Process $OneDriveExecutable -NoNewWindow
Write-Output "OneDrive client launched successfully."
} catch {
Write-Output "Failed to launch OneDrive client. Exiting script."
Exit 1
}
} else {
Write-Output "OneDrive executable not found after installation. Exiting script."
Exit 1
}
# Clean up installer file
Remove-Item $InstallerPath -Force
# Step 4: Success Message
Write-Output "OneDrive installation and launch completed successfully."
Write-Output "Success Code: 0"
Script Download
# ___ _ ___ ___ _
# / __(_)_ __ /___\_ __ ___ / \_ __(_)_ _____
# / _\ | \ \/ / // // '_ \ / _ \ / /\ / '__| \ \ / / _ \
#/ / | |> < / \_//| | | | __// /_//| | | |\ V / __/
#\/ |_/_/\_\ \___/ |_| |_|\___/___,' |_| |_| \_/ \___|
#
# Copyright 2024 - Liam-Robinson.co.uk
#
#The purpose of this script is to remove the broken onedrive client caused by July 2024 Windows Update and install a know working version until an official fix is implemented.
# Uninstall OneDrive
Write-Host "Uninstalling OneDrive..." -ForegroundColor Green
winget uninstall --name "Microsoft OneDrive" --source winget --silent --nowarn
Start-Sleep -Seconds 10 # Wait to ensure uninstallation completes
# Install the latest version of OneDrive using winget
Write-Host "Installing the latest version of OneDrive using winget..." -ForegroundColor Green
winget install --name "Microsoft OneDrive" --source winget --silent --custom "/allusers /silent"
Start-Sleep -Seconds 30 # Wait to ensure installation completes
# Function to check if OneDrive executable exists and launch it
function Launch-OneDrive {
$paths = @(
"$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe",
"$env:PROGRAMFILES\Microsoft OneDrive\OneDrive.exe",
"$env:PROGRAMFILES(X86)\Microsoft OneDrive\OneDrive.exe"
)
foreach ($path in $paths) {
if (Test-Path $path) {
Write-Host "Launching OneDrive from $path..." -ForegroundColor Green
Start-Process $path
return
}
}
Write-Host "OneDrive executable not found in any expected location." -ForegroundColor Red
}
# Launch OneDrive
Write-Host "Launching Onedrive..." -ForegroundColor Green
Launch-OneDrive
Write-Host "OneDrive installation and launch process complete." -ForegroundColor Green
#GPupdate (if using silently configure sroup policy)
Invoke-Expression "gpupdate /force"
# Ask user if they want to reboot
Write-Host "Install complete. Do you wish to reboot? Y/N?" -ForegroundColor Yellow
$response = Read-Host
if ($response -eq 'Y' -or $response -eq 'y') {
Write-Host "Rebooting system..." -ForegroundColor Green
Restart-Computer -Force
} else {
Write-Host "Reboot cancelled. Please restart your system manually if necessary." -ForegroundColor Yellow
}
Once the client has installed it should go back to version 24.151.0728.003 and the issue will no longer persist.
#EdTech Network Manager, experienced in Microsoft 365, Server 2019, Intune, SCCM and anything inbetween.
Hi, Liam
Only my test device picked up this Onedrive version. Which update channel are you using? I wonder if the more stable channels are ringfenced.
Best wishes,
James
Hi James,
Windows is running on GA channel and OneDrive is set to Production channel via GPO. It’s strange as according to the release notes (at the time of writing) the latest release currently rolling out is Version 24.141.0714.0002 (July 24, 2024), where as the problematic version is 24.146.0721.0003. Using my fix winget installs 24.132.0701.0002, but when you run it it auto upgrades to 24.151.0728.0003 (which isn’t referenced anywhere!)
Hi Liam,
You wrote “…workaround i have found is to downgrade the OneDrive client.”
Your client with the issue was: 24.146.0721.0003 and you install 24.151.0728.0003
So that is (from wording perspective) not a downgrade ist an upgrade to a newer version,
means 5 workdays after 146.
I have all OneDrive Versions on my page: https://hansbrender.com/versionen/
But good article, I have published also an article and point it to your article.
https://hansbrender.com/2024/08/15/windows-11-update-kb5040442-and-od-24-146-0721-0003-2/
Apologies you are correct, poor wording on my behalf. I think I meant it in the sense we were “reverting” back to the version which was installed before the update changed it to 24.146. However since then we’ve realised its not actually the OneDrive version that’s the issue, it’s an issue with Microsoft Update 2024-07. Uninstalling OneDrive and re-installing any client version should fix it. Thank you for he mention on your blog.
Had exactly the same issue here and had similar experience around versioning to of OneDrive client. Thanks for the post.
I have linked to it from a blog being posted later today.
https://lilysdad2.wordpress.com/2024/08/20/onedrive-storage-bug-august-2024/
Keep up the good work
Thanks for the mention in your article! It’s still an issue I’m afraid, we’ve seen the problem on both PC’s that have been freshly wiped with a clean install and ex W10 devices that have been upgraded in place. I haven’t heard anything back since my last correspondence so presume its still not been fixed yet.
Thanks for the article Liam, as other have said it’s not well documented.
We’re also seeing the issue on freshly imaged Windows 10 22H2 computers with 2024-08 update. Uninstalling OneDrive client (24.151.0728.0003) doesn’t free up the disk space; we need to remove the user profile to do so. Installing the latest OneDrive client (24.161.0811.0001) also doesn’t free up the disk and it’s yet to be seen whether this version resolves the issue (previous versions didn’t).
just wanted to come back and say that we are seeing that this is looking resolved with the September 2024 patching. certainly from our testing OneDrive is now behaving after a reset
Thanks Andy. Yes it appears to have calmed down with us now, hopefully no more issues!
Thank goodness I found your article – lifesaver. This hit me today in the following not unlikely scenario:
1. Install clean Windows 11 Pro and updates
2. OneDrive is version 24.180.x.y
3. Install Microsoft 365 apps from web and an OLDER version of OneDrive gets installed!! Version 23.038.x.y
4. Spot the out of date user interface so search web for OneDrive download – this takes you to 24.161.x.y which is broken (why is it still the live download???)
5. Synchronise a big M365 OneDrive and wonder why your 1TB disk fills up!
There are IMO three major flaws here:
1. The initial bug in 24.161.x.y – not good!
2. Microsoft 365 app installer going back from a perfectly working version to an old version
3. Manual update/Google leads you to the flawed 24.161.x.y version