Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

AppLocker events 8003 and 8004: allowed in audit, blocked when enforced

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

A program that ran yesterday now will not start, and the AppLocker log has event 8004. On another computer under the same policy, the same program starts, and the log has event 8003 saying it would have been blocked. Both computers are doing what the policy says. The difference is a setting called the enforcement mode.

Events 8003 and 8004 are the two ends of one decision. AppLocker evaluates a program against the rules and reaches a result, and what happens next depends on whether the rule collection is set to Audit only or to Enforce rules. Below are what each event means, how to read them without changing anything, the choices for dealing with a program that should run, and what to confirm afterwards. Nothing before the Fix section changes anything.

What the error means

Microsoft says that the AppLocker log contains information about applications affected by AppLocker rules, and that each event shows details such as which file is affected and its path, whether the file or packaged app is allowed or blocked, the rule type (path, file hash or publisher), the rule name and the security identifier for the user or group in the rule. The log is in Event Viewer under Application and Services Logs\Microsoft\Windows, in the entry named AppLocker.

Event 8003 is a Warning. Microsoft prints its message as "was allowed to run but would have been prevented from running if the AppLocker policy were enforced." with the file name in front, and says it is "Shown only when the Audit only enforcement mode is enabled". It indicates that the AppLocker policy would block the .exe or .dll file if the enforcement mode setting were Enforce rules.

Event 8004 is an Error. Its message is "was prevented from running." with the file name in front, and Microsoft describes it as AppLocker having blocked the named EXE or DLL file, "Shown only when the Enforce rules enforcement mode is enabled".

The two events apply to EXE and DLL files. Microsoft's table has the same pattern for scripts and installer files: event 8005 for an allowed script or .msi file, 8006 as the audit warning and 8007 as the block. Events 8020 to 8025 carry similar allowed, would-have-been-prevented and prevented messages, and the table marks them "Added in Windows Server 2012 and Windows 8". Event 8002 is the plain "was allowed to run" for an EXE or DLL file. Event 8001 is "The AppLocker policy was applied successfully to this computer." and event 8000 is "AppID policy conversion failed", which means the policy was not applied correctly.

Microsoft's page notes that the AppLocker logs are very verbose, particularly the EXE and DLL log. If events are forwarded to a collection service, it suggests adjusting the collection to take only Error events, or none from that log.

Likely causes

The enforcement mode decides whether a file the policy does not allow produces 8003 or 8004.

What you see What it means What decides it
8003 for a file, no block The policy would block this file, but the rule collection is on Audit only The enforcement mode of the EXE and DLL collection
8004 for a file, block The policy blocks this file, and the collection is on Enforce rules The same mode setting, now set to Enforce
8003 turns into 8004 after a policy change The collection was switched from Audit only to Enforce rules Microsoft describes this switch as the deployment step for most organisations
8004 for a program that used to run Microsoft says that in Enforce rules mode any file the policy does not allow is blocked The rule set, not the mode

Microsoft's guidance on checking the log names one gap. It says to look for applications that the automatically generated rules did not include, and gives the example of line-of-business apps installed to nonstandard locations, such as the root of the active drive, for instance %SystemDrive%. A program in such a location can pass in audit and fail in enforcement because no rule names it.

Prove the cause before changing anything

All of these only read.

  1. Start Event Viewer and go to Application and Services Logs\Microsoft\Windows, then AppLocker. Microsoft says events are in the EXE and DLL log, the MSI and Script log, or the Packaged app-Deployment or Packaged app-Execution log. Find the event for the file, and note the event number, the file name, the rule name and the user.

  2. Read the mode. Microsoft says an event carries the enforcement setting among its details. The same value is on the Enforcement tab of the AppLocker Properties dialog: in the AppLocker console, right-click AppLocker, choose Properties and read the Enforcement tab for the rule collection. Close the dialog without changing anything.

  3. Count the affected files. On the computer where the events are written, Microsoft's page gives two PowerShell commands. They determine which files were blocked or would be blocked in audit-only mode, and how many times each file was affected. The commands are below. Microsoft says the minimum permission is membership of the local Administrators group or equivalent.

  4. Check that the policy that is meant to apply has arrived. Microsoft's page on refreshing a policy says to check the AppLocker event logs for events that include "policy applied". In Microsoft's event table the nearest message is event 8001, "The AppLocker policy was applied successfully to this computer."

The commands, each of which only reads:

Get-AppLockerFileInformation -EventLog -EventType Audited -Statistics
Get-AppLockerFileInformation -EventLog -EventType Allowed -Statistics

The first reports how many times the policy did not allow a file. The second reports how many times a file was allowed to run or prevented from running.

Example (illustrative): at contoso.com.au a session host is running a new AppLocker policy in Audit only mode. A bookkeeping program installed under C:\Apps\Ledger logs 8003 for ledger.exe on every start. The rule name in the event is the default rule for the Program Files folders, which does not cover C:\Apps. In audit the program runs. When the collection is switched to Enforce rules, the same start logs 8004 and the program is blocked. The cause is a missing rule, and the mode only decides whether the gap is visible or painful.

Fix

Decide first whether the file should run. An 8003 for a program nobody recognises is a reason to stop and ask what it is, not a reason to write a rule for it. That is general advice, and the page gives no test for it.

For a file that should run, there are two courses. Add a rule that allows it, or leave the collection on Audit only until the rules are ready. Microsoft's pages describe the first as creating a rule that uses a publisher condition, a file hash condition or a path condition, and point to separate pages for each. Microsoft's event page does not walk through them, so adding a rule is described here and not carried out.

Set the collection back to Audit only

Use this when a program is blocked now and the rule is not ready.

Save first. Export the current AppLocker policy with the AppLocker Export Policy feature, which Microsoft's refresh page names, and keep the file. The page gives no command for this, only the console feature.

Risk: the next step stops AppLocker from blocking anything in that rule collection. Microsoft says that in Audit only mode rules are only evaluated and the events are written to the log, so every program the policy would have blocked will run, including unwanted ones. Do it only for the collection that is blocking the program, and put the collection back to Enforce rules when the rule exists.

In the AppLocker console, right-click AppLocker, choose Properties, and on the Enforcement tab select the Configured check box for the rule collection that you want to audit and verify that Audit only is selected in the list for that rule collection. Select OK.

To undo it: this switches blocking back on for that rule collection, so every program the policy does not allow is blocked again, including the one that was blocked before. Microsoft's page on the other mode gives the reverse steps. On the Enforcement tab, select the Configured check box for the rule collection and verify that Enforce rules is selected. Select OK.

Apply the change on computers that use Group Policy

Microsoft says that if you change the rule collection on a local computer through the Local Security Policy snap-in, the policy takes effect immediately. If Group Policy distributes the AppLocker policy, a manual refresh makes it take effect at once, and the refresh might take several minutes depending on the number of policies and target computers.

Save first. Keep the exported policy from the previous step, and note the time before the refresh.

Disruptive step: the next command forces a Group Policy refresh on the computer. Microsoft's page does not limit it to AppLocker, so treat it as applying whatever any policy has changed, and the page gives no way to undo the refresh itself. Run it first on one test computer.

gpupdate /force

Microsoft's page says to run it from a command prompt, wait for it to finish and then verify that the intended rule behaviour is correct by checking the AppLocker event logs.

To undo it: the refresh itself cannot be taken back. Running the refresh again applies whatever any policy has changed on that computer at that moment, not only AppLocker, so it carries the same warning as the first run. Reverse the policy change as above and, only if it is needed, run the refresh again under the warning above.

Importing a policy

Microsoft's refresh page names exporting and importing a policy as one way to copy a change to another device, and gives a warning in its own words: when importing rules from another computer, all the rules will be applied, not just the one that was updated. Merging policies is the other route the page names. Both are described here and not walked through.

Confirm the fix

  • The program starts, and the log shows 8002 ("was allowed to run") for it where a rule now allows it, or 8003 while the collection is still on Audit only.
  • If the collection was put back to Enforce rules after the rule was made, the same program logs no 8004.
  • Event 8001 appears after the policy refresh.
  • Counting with the statistics command above shows fewer files in the audited total than before.

What to watch afterwards

  • Programs in nonstandard locations, such as the root of the active drive. Microsoft names them as a gap.
  • Updates that move a program to a new folder or change its signature. A rule built on a file path, hash or publisher can stop matching.
  • Log volume. Microsoft says the EXE and DLL log can be very large.
  • Which rule collections are on Audit only. A collection left on Audit only does not block anything, since its 8003 events are warnings and not blocks.
  • Event 8000, which means a policy did not apply at all.

Risks and limits

These steps have not been run or lab-tested. Microsoft's event page was last updated on 2024-10-01, and the enforcement and refresh pages carry the same date. The monitoring page is dated 2026-11-18. The event table gives no version range for 8003 and 8004 and does not say where each event appears in the packaged app logs.

The messages on the page are printed with a file-name placeholder and stray spaces around asterisks, for example *<File name> * was prevented from running.; the file name in a real event replaces the placeholder. The page does not say how to make a rule, and the path in the example above is an illustration, not a finding from a real server. Switching the mode or refreshing policy changes what every user on the computer can run. Keep an exported copy of the policy, test on one computer and change one rule collection at a time.

Sources