SCCM

SCCM Detection Methods Explained and Error 0x87D00324

A detection method is the test SCCM uses to decide if an application is installed. The client runs it before the install and again after it. If the test passes too early, the app shows "Installed" and never runs. If it fails after the install, you get error 0x87D00324.

When the client runs detection

WhenResultWhat the client does
Before the installDetectedMarks the application as installed. The installer does not run.
Before the installNot detectedDownloads the content and runs the install command.
After the installDetectedReports success.
After the installNot detectedReports a failure with 0x87D00324.

The client also runs detection in each Application Deployment Evaluation Cycle. A required application that is no longer detected installs again.

Uninstall works the other way around. After the uninstall command, the application must no longer be detected.

Why an app shows "Installed" when it is not

The rule is true on a computer that does not have the application. The installer never runs, and Software Center shows "Installed". Common causes:

  • The rule checks a file or folder that other software also creates.
  • The rule checks that a file exists, and an older version left that file behind.
  • The rule checks a registry key that survives an uninstall.
  • A detection script always writes output, even when it finds nothing.

Make the rule specific. Check a version, not only that a file exists.

Why an install fails with 0x87D00324

0x87D00324 means the application was not detected after the install finished. The installer ran and returned a success exit code. Then the detection method said "not installed".

The install often worked. The rule is what is wrong. Common causes:

  • The path, version or product code in the rule does not match what the installer writes.
  • The rule looks in the 64-bit location and the application is 32-bit, or the other way around.
  • A new version of the installer has a new MSI product code, and the rule still has the old one.
  • The install command starts a second process and returns at once. Detection runs before the real install ends.
  • The install wrote to the profile or registry of one user, and detection runs as SYSTEM.
  • The installer returned 0 but did nothing, for example because of a wrong switch.

The error page has more detail: 0x87D00324.

The detection types

Set the detection method on the deployment type. In the console, go to Software Library, Application Management, Applications. Open the deployment type and select the Detection Method tab.

TypeWhat it checksGood forWatch out for
Windows InstallerThe MSI product code. You can add a version check.MSI installs. SCCM fills it in when you create the application from an MSI.Each new version has a new product code. Update the rule with the content.
File systemA file or folder exists, or a file property such as version, size or date meets a condition.EXE installers. The version of the main program file is a strong test.32-bit and 64-bit paths. Files in a user profile.
RegistryA key or value exists, or a value meets a condition.The uninstall key with a DisplayVersion value.32-bit and 64-bit registry views. Keys under HKEY_CURRENT_USER.
ScriptAnything you can test in PowerShell, VBScript or JScript.Cases the other types cannot express.The output rule below. Script signing.

You can join several clauses with AND and OR. Keep it simple. One strong clause is easier to fix than five weak ones.

For a version test, use "greater than or equal to" where it makes sense. The application then still counts as installed after it updates itself.

The script rule

A detection script does not return true or false. The client reads three things: the exit code, the standard output and the standard error.

Exit codeStandard outputStandard errorResult
0EmptyEmptyNot installed
0Any textEmptyInstalled
0Any textAny textInstalled
0EmptyAny textDetection failed
Not 0AnyAnyDetection failed

In short: output plus exit code 0 means detected. No output plus exit code 0 means not detected. Any other result is an error, not a "no".

A correct script writes one line when it finds the application and nothing when it does not:

$file = 'C:\Program Files\Contoso\App\app.exe'

if (Test-Path -Path $file) {
    $version = [version](Get-Item -Path $file).VersionInfo.FileVersion
    if ($version -ge [version]'2.5.0.0') {
        Write-Output 'Installed'
    }
}

exit 0

Common script mistakes:

  • The script writes False or Not installed when the application is missing. Any output counts as detected.
  • A command inside the script prints a value you did not expect. That output also counts as detected.
  • The script ends with exit 1 for "not installed". The client treats that as a failed detection.
  • The script is not signed and the client blocks it. The PowerShell execution policy setting in the Computer Agent group of client settings controls this. Its default is All Signed.

The SCCM detection script builder writes a script that follows these rules.

32-bit and 64-bit pitfalls

On 64-bit Windows, a 32-bit application lives in different places from a 64-bit one.

Item64-bit application32-bit application
Program filesC:\Program FilesC:\Program Files (x86)
RegistryHKLM\SOFTWAREHKLM\SOFTWARE\WOW6432Node

File and registry rules have a check box for this: This file or folder is associated with a 32-bit application on 64-bit systems. The registry rule has the same option for registry keys. Tick it for a 32-bit application. Then write the path without (x86) or WOW6432Node. The client checks the 32-bit location first and then the 64-bit one.

Scripts have their own option: Run script as 32-bit process on 64-bit clients. Leave it clear in most cases. A 32-bit script process is redirected, so a path to HKLM\SOFTWARE lands in WOW6432Node.

User context pitfalls

For an application that installs for the system, detection runs as the SYSTEM account. SYSTEM has its own profile and its own HKEY_CURRENT_USER. A rule that checks %APPDATA% or HKCU does not look at the signed-in user.

For a per-user application, set the deployment type to install for the user. Detection then runs as that user.

Test a detection method

  1. Install the application by hand on a test computer, with the exact command from the deployment type.
  2. Check that the file, registry value or product code from your rule exists. Compare every character.
  3. For a script, run it as SYSTEM, for example with PsExec and psexec -s powershell.exe. Confirm that it writes one line.
  4. Uninstall the application and run the test again. A script must now write nothing and exit with 0.
  5. Deploy the application to the test computer as Available and install it from Software Center.
  6. Open AppDiscovery.log in C:\Windows\CCM\Logs. Find the lines for your application.

AppDiscovery.log shows the detection result for each deployment type, before and after the install. Look for lines that say the application was detected or not discovered. For a script, the log also shows a script error.

After you change a detection method, the client needs the new policy. Run Machine Policy Retrieval and Evaluation, then Application Deployment Evaluation. See SCCM client actions explained.

If detection is fine and the deployment still fails, follow how to troubleshoot a failed SCCM application deployment.

SCCM MECM detection method 0x87D00324 AppDiscovery.log applications
✉

Get new articles in your inbox

SCCM guides, AI tools, automation tips — sent when published. No spam.

Keep reading

Comments