Skip to main content
    All posts
    Intune
    Win32 App
    Uninstall
    Exit Codes
    MSI

    Intune Uninstall Returns 0 But the App Is Still Installed: The Self-Copying Uninstaller Trap

    Andrew MartyNovember 24, 20266 min read

    Intune runs your uninstall command, the process exits with 0, and a few minutes later the device reports the app as still installed. Nothing failed, so there is nothing in the log to chase. The usual cause is a legacy EXE uninstaller that copies itself to a temp folder, launches that copy, and exits immediately. Intune is watching the launcher, not the process doing the work.

    Fast Verdict Matrix

    Uninstall BehaviorLegacy EXE BehaviorNative MSI Behavior
    Process Intune waits onSome uninstallers (NSIS is the classic case) relaunch from a temp copy and the original process exits at once. Intune sees the exit, not the removal.msiexec.exe /x runs the removal in the process Intune is waiting on, and the Windows Installer service finishes before it returns.
    Exit code reliability0 can mean "launched the real uninstaller", not "removed the app".A standard Windows Installer code (0, 1605, 1603, 3010) that reflects the real outcome.
    Silent switchDiffers per framework (/S, /VERYSILENT, /s /f1 response files) and per vendor build.Always /qn. Same command for every package.
    Intune's post-uninstall checkDetection runs while the real uninstaller is still working, so the app still appears present and the status flips back to installed.Detection runs after removal completes. Product-code detection returns "not found" cleanly.

    The Rule of Thumb

    • An exit code of 0 from an EXE uninstaller proves the launcher started, not that the app is gone. Verify by checking the detection target after the command finishes, not by trusting the return code.
    • If the uninstaller spawns a child, Intune cannot wait for it. Either force the uninstaller to stay in-process or replace it with an uninstall command that is synchronous by design.

    The Fix: A Synchronous Uninstall

    The common workaround is a PowerShell wrapper, often PSAppDeployToolkit, that starts the uninstaller, finds the child process by name, waits for it, and then removes leftover keys. It works until the vendor renames the temp binary or changes how the uninstaller relaunches itself. Then the wait loop exits early again and you are back to phantom "still installed" reports.

    InstallMage removes the problem instead of scripting around it. It converts the EXE into a native MSI, and the uninstall becomes msiexec.exe /x {ProductCode} /qn. That runs in the process Intune is monitoring, finishes before it returns, and reports a standard Windows Installer exit code. No child-process wait loop, no per-vendor uninstall switch to maintain.

    Deep Dive

    The Self-Copy Pattern

    An uninstaller cannot delete its own executable while it is running, so many of them copy themselves to a temp location, start the copy, and exit so the original file can be removed. NSIS uninstallers behave this way. Run unmodified, the original process returns quickly while the temp copy does the real work in the background. NSIS documents the _?= parameter, which makes the uninstaller run in place and therefore synchronously, at the cost that it can no longer delete itself.

    # Returns almost immediately (the temp copy does the work)
    "C:\Program Files\Vendor\Uninstall.exe" /S
    
    # Stays in-process, so the caller can wait on it
    "C:\Program Files\Vendor\Uninstall.exe" /S _?=C:\Program Files\Vendor

    Not every framework offers an equivalent, and the behavior of a given vendor build is rarely documented. Test it: run the command under SYSTEM and compare the time the command takes to return with the time until the files actually disappear. A large gap means the process you are waiting on is not the one doing the work.

    What Intune Actually Measures

    The Intune Management Extension starts the uninstall command line, waits for that process to exit, maps its exit code against the app's return codes, and then evaluates the detection rule. If the command exits before the removal is done, detection runs too early, still finds the app, and the assignment is treated as not uninstalled. The next sync can then try again against a half-removed install, which is how some devices end up with partially deleted folders and broken shortcuts.

    The log to read is C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log. Look at the timestamps between the line that starts the uninstall command and the line that reports its exit code. A uninstall that "took" under a second for an application with hundreds of files is the signature of the self-copy pattern.

    Making Detection Agree With Removal

    Even after the uninstall truly finishes, a file or registry detection rule can still match a leftover artifact such as a config file, a log folder, or an ARP key the uninstaller never cleaned. Intune then reports the app as present although the program is gone. See broken EXE uninstall strings for the orphaned-key side of this. An MSI product-code detection rule avoids both problems because Windows Installer owns the product registration and removes it as part of the same transaction. For the 32-bit side of detection, see WOW6432Node registry redirection.

    Frequently Asked Questions

    Why does Intune show an app as installed after a successful uninstall?

    The uninstall command probably exited before the real removal finished, so the detection rule ran while the app was still present. This happens with uninstallers that relaunch from a temp copy. Compare how long the command takes to return with how long the files take to disappear, and check the timestamps in IntuneManagementExtension.log.

    Why does my uninstall command return exit code 0 immediately?

    The process you started is a launcher. It handed the work to a temporary copy of the uninstaller and exited with 0. For NSIS-based uninstallers, the _?= parameter keeps the uninstaller in-process so the exit code reflects the actual result. Other frameworks need their own approach or a wrapper that waits.

    Does an MSI uninstall avoid this problem?

    Yes. msiexec.exe /x {ProductCode} /qn is synchronous: it returns only after the Windows Installer transaction completes, with a standard exit code. InstallMage generates the MSI from your EXE, so the uninstall command is the same for every app.

    Keep reading