This blog explains how the Intune Management Extension (IME) handles the cleanup of the IMECache folder after it has finished installing a Win32App. We will also examine what happens when cleanup fails and why some folders persist even after a reboot.
Introduction
Let me start by saying that if youāve ever dug around on a device after a successful Win32 app deployment and found leftover folders in C:\Windows\IMECache, youāre not alone.
You might have wondered why those folders in the IMECache are still there, even though the win32 app appeared to be successfully installed hours or even days ago. We will walk through how the Intune Management Extension (SideCar) unpacks and manages the Win32 app content. Weāll examine when the folder is reused, when itās deleted, what triggers re-extraction, and what happens when something blocks the cleanup.
From Encrypted download to the IMECache Folder
When a Win32 app is deployed through Intune, the .intunewin package first lands in a temporary download location. The moment the file drops down in the incoming folder, it is still encrypted. The agent then decrypts the file and unzips it into a subfolder inside C:\Windows\IMECache. (For more details about the whole installation flow, check out our webinar)
This folder contains the raw content used for detection and installation, think install.cmd, MSI files, PowerShell scripts, or whatever else was packaged. The folder name follows the format of AppId_AppVersion.
This unzip and staging process is handled by a component inside the agent called ContentUnzipper.

What determines whether IME unzips the Win32App again
Hereās where the reuse logic comes in. IME doesnāt automatically unzip the same app every time itās triggered. It checks whether a matching folder already exists in IMECache. If it does, and the folder is less than 36 hours old, itās reused.

But thereās an override in place. Some flows, like a retry, or certain enforcement cycles, force a re-unzip no matter what. Internally, this is controlled by a parameter called alwaysRefresh. When thatās set to true, IME skips the age check and deletes the folder anyway.
So the real behavior looks like this:
- If the folder is fresh and alwaysRefresh is false, IME reuses it.
- If itās older than 36 hours or alwaysRefresh is true, it gets deleted, and the content is unzipped again.
After installation, the IMECache cleanup begins.. (or at least tries to)
Once the app has been installed successfully, IME attempts to clean up the extracted folder. It does this by calling its internal file system methods to delete the IMECache subfolder.

If that delete works, the folder is gone. If it fails due to locked files, bad permissions, or anything else, IME logs the error and schedules the folder for deletion on the next reboot.

This is done through the Windows API MoveFileEx.

The MoveFileEX will add an entry to the PendingFileRenameOperations registry value under HKLM\SYSTEM\CurrentControlSet\Control\Session Manager.
On the next reboot, Windows checks this registry key and āattemptsā to delete whatever was listed. (if it has enough permissions to do so)
But that doesnāt always work either.
Hereās the thing. MoveFileEx works great for files and folders that are empty and not locked. However, if the folder contains files in use or has restricted permissions, the deletion fails silently. Windows doesnāt log or retry; it just moves on.
This is why you may sometimes see lingering folders still sitting in IMECache after a reboot, even though they were clearly marked for deletion in the registry beforehand.
What about the IMECache permissions during unzip
During the unzip process, IME sometimes sets permissions on the extracted folder, but only under specific conditions.
If the app has a contentCacheDuration set to int.MaxValue, which usually means the app should be reused indefinitely across sessions, IME adds Read and Execute permissions for the INTERACTIVE user group. That way, the content can still be accessed.

Outside of that case, IME doesnāt mess with permissions. Therefore, if an installer script or MSI changes ACLs during installation, it locks the SYSTEM or administrator account out of the folder, which will block deletion later. Itās worth noting that the IME doesnāt attempt to fix or reset permissions after the app has been installed. So, if you mess with the IMECache folder⦠well, good luck⦠You need to fix that yourself!
The IMECache Leftovers
If youāre trying to figure out why a Win32 app keeps reinstalling or why detection fails even though the app is clearly present, the IMECache folder is one of the first places to look. It tells the story of what content was extracted, when, and whether IME thinks it needs to start fresh.
It also gives you clues about cleanup failures. If the folderās timestamp is old or if it persists through reboots, check for leftover locks, permission changes, or detection scripts that still reference it. You can also check the registry under PendingFileRenameOperations to confirm whether IME tried to schedule deletion.
Conclusion
The IMECache folder is part of a controlled IME/Sidecar process. If an app is installed successfully, the folder should be removed. If that fails, it is scheduled for deletion after a reboot. Also worth noting is that if permissions or locks get in the way, the folder can survive even after multiple reboots. With it you need to manually remove that folder yourself!
Ā