Home › Microsoft Intune › 0x87D00321

Microsoft Intune · 0x87D00321 · Microsoft Intune Win32 App

Intune Win32 App Error 0x87D00321: Detection Failed

Installer exits 0 but detection rule fails due to path mismatch or context error. Fix by correcting the detection method to match actual install location.

Error Details

FactValueSourceNote
Exact Error Code0x87D00321Intune Admin Center / IME LogSYNCML_DM_TARGET_NOT_FOUND
Affected OS BuildWindows 10/11 (All supported builds)Microsoft DocumentationWin32 App deployment scenario
Registry Key CheckHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\UninstallLocal RegistryVerify MSI ProductCode or File Version
Relevant ServiceIntune Management ExtensionWindows ServicesHandles app installation and detection
Log Line SignatureDetection rule result: Not DetectedIntuneManagementExtension.logAppears after install exit code 0

Log Files to Check

What This Error Actually Means

The error code 0x87D00321, technically defined as SYNCML_DM_TARGET_NOT_FOUND, represents a critical state mismatch within the Microsoft Intune Management Extension (IME) engine. It is vital to understand that this error does not indicate a failure of the installation executable itself. In fact, the installer process has almost certainly completed successfully, returning an exit code of 0. The failure occurs strictly in the post-installation validation phase. When Intune executes a Win32 app deployment, it follows a strict sequence: download payload, execute install command, wait for process termination, and finally, execute the detection rule to verify presence.

The IME raises 0x87D00321 when the detection rule returns a "Not Detected" status immediately after the installer exits with success. This creates a paradoxical state where the device reports the app as failed, yet the application is likely fully functional on the endpoint. The component responsible for this evaluation is the Intune Management Extension service (IntuneManagementExtension). It compares the expected detection criteria (file path, registry key, or MSI product code) against the actual system state. If the criteria are not met, the IME logs the target as missing, effectively marking the deployment as failed in the cloud backend, even though no installation error occurred.

Affected Versions and Scope

This issue is pervasive across all supported Windows 10 and Windows 11 builds, including LTSC editions. It is not tied to a specific OS version but rather to the configuration of the Win32 app package and the detection logic defined in the Intune Admin Center. The scope includes any device enrolled via Azure AD Join, Hybrid Azure AD Join, or MDM-only enrollment, provided the Intune Management Extension is installed and functioning. However, this error is exclusive to Win32 apps (.intunewin packages). It does not apply to MSI apps managed via Configuration Manager co-management unless they are repackaged as Win32 apps, nor does it apply to Microsoft Store for Business apps or Line-of-Business (LOB) apps which use different detection mechanisms.

Tenant configurations that frequently encounter this include environments using per-user installations in a system-context deployment, or applications that install to dynamic paths based on the executing user's profile. It is also common in scenarios where the application installer performs silent updates or defers installation until a reboot, causing the immediate post-install detection check to fail because the files are not yet present in the expected location.

Where To Look First: Logs and Event IDs

To diagnose 0x87D00321, you must inspect the local logs on the affected endpoint. The primary source of truth is the Intune Management Extension log located at C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log. Use a tool like CMTrace or PowerShell to search for the specific error code or the detection failure signature.

The literal log line you are looking for is: Detection rule result: Not Detected. This line will appear shortly after the install command logs its exit code. If the exit code is 0 but this line follows, the issue is purely detection-related. Additionally, check C:\Windows\CCM\Logs\AppEnforce.log if you are using co-management or legacy SCCM integration, though for pure Intune Win32 apps, the IME log is definitive.

Correlate this with Event Viewer logs. Look for Event ID 1000 in the Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin log, which often contains high-level summaries of app enforcement failures. Also, check Event ID 200 in the same log for detailed IME operational events. You can retrieve these using PowerShell:

Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" -MaxEvents 50 | Where-Object {$_.Id -eq 1000 -or $_.Id -eq 200}

Root Causes

Detection Rule Path Mismatch (User vs. System Context)

The most common cause is a context mismatch. If the installer runs in System context (default for Win32 apps), it installs to machine-wide paths like C:\Program Files. However, if your detection rule checks a user-specific path like C:\Users\%USERNAME%\AppData, it will fail because the System account does not have a standard user profile structure. Conversely, if the app installs per-user but you detect via HKLM registry keys, it will fail.

Incorrect MSI Product Code or Version

If using an MSI detection rule, the ProductCode (GUID) must match exactly what is written to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. A mismatch here, even by a single character, causes immediate failure. Similarly, if you specify a minimum version in the detection rule and the installed version is lower, Intune reports it as not found.

Registry Redirection (WOW64)

On 64-bit systems, 32-bit applications install to C:\Program Files (x86). If your detection rule checks C:\Program Files for a 32-bit app, it will fail. Ensure your detection path matches the architecture of the installer.

Fix Procedure

  1. Verify Installation Location: Manually run the install command on a test device in System context. Use PowerShell to check where files were placed: Get-ChildItem -Path "C:\Program Files" -Recurse -Filter "*AppName*" -ErrorAction SilentlyContinue.
  2. Update Detection Rule: In the Intune admin center, navigate to Apps > All apps, select your Win32 app, and go to Detection rules. Edit the rule to match the actual file path or registry key found in step 1. For MSI apps, verify the ProductCode against the registry: Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where-Object {$_.DisplayName -like "*AppName*"} | Select-Object PSChildName.
  3. Validate Context: Ensure the "Install behavior" is set to "System" if the app installs globally. If it must be per-user, ensure the detection rule uses user-specific paths and that the assignment targets users, not devices.
  4. Repackage if Necessary: If the installer modifies paths dynamically, you may need to repackage the .intunewin file with a corrected detection script. Use the Win32 Content Prep Tool again with the updated detection logic.
Warning: Do not disable the Intune Management Extension service or delete its logs to force a retry. This can break enrollment and cause other policies to fail. Always use the "Sync" button in the Company Portal or run dsregcmd /status to verify connectivity before making changes.

Error Code Variants

Error CodeDescriptionDistinguishing Factor
0x87D00321SYNCML_DM_TARGET_NOT_FOUNDInstaller succeeded (exit 0), but detection rule failed.
0x80070005Access DeniedIME lacks permissions to write files or registry keys during install.
0x80070643Installation FailedThe installer executable itself returned a non-zero exit code.
0x87D00215Download FailedIME could not download the payload from Azure CDN.

Verification

To prove the fix worked, trigger a sync on the device. Open PowerShell as Administrator and run: Invoke-MgGraphRequest -Method POST -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices('{deviceId}')/syncDevice". Then, monitor the IME log again. You should see the install command execute, return exit code 0, and immediately follow with Detection rule result: Detected. In the Intune admin center, navigate to Apps > [Your App] > Device install status. The device should transition from "Error" or "Failed" to "Success".

Tip: Use the OMA-URI ./Device/Vendor/MSFT/Management/OMAUri to push a custom script that logs the detection rule result directly to a text file on the endpoint for easier debugging without parsing large log files.

Prevention

To prevent recurrence, always test detection rules in a lab environment before deployment. Use the "Test detection rule" feature in the Intune admin center if available, or manually verify the registry/file existence on a reference device. Create a baseline configuration that enforces consistent installation paths for all Win32 apps. Additionally, consider using PowerShell scripts as detection methods for complex applications, as they offer more flexibility than static file/registry checks. Regularly audit your app deployments in Intune admin center > Apps > All apps to identify any apps with high failure rates and update their detection logic proactively.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.