Skip to main content

Excessive Logon Attempts

Purpose​

This solution watches domain controllers for an unusual number of failed logon attempts, which can indicate a brute-force or password-spraying attack. Every 4 hours, the Monitor - Excessive Logon Attempts compound condition runs the Excessive Logon Attempts automation on the domain controller that holds the Infrastructure Master role. The automation counts the failed logons (Security event ID 4625) recorded since its previous run. When the count reaches the threshold, NinjaOne creates a ConnectWise Manage ticket from the Excessive Logon Failures ticket template. The ticket lists the failures grouped by user, domain and source IP address.

The threshold, the exclusions and whether monitoring is on are all set in cPVAL Excessive Logon custom fields at the organization, location or device level, so each client, site or domain controller can be tuned without editing the automation or the compound condition.

Platform: NinjaOne

Key Capabilities​

  • No gaps or overlaps between runs – Each run counts the failed logons recorded since the previous run, using the time saved in cPVAL Excessive Logon LastRunTime. After the agent has been offline, the next run covers the whole time since the last run.
  • Tuned per client, location or device – The threshold, the exclusions and an on/off switch are custom fields that can be set at the organization, location or device level.
  • Targeted exclusions – Known harmless failures can be ignored by username, by computer, by domain, by source workstation or by logon process. Every exclusion accepts the * and ? wildcards.
  • Built-in noise filtering – Batch and service logons, and a computer account failing from its own workstation, are never counted.
  • Detailed tickets – The ticket lists each user, domain and source IP address with the workstation, logon type, failure status, logon process, calling process, number of occurrences and time of the most recent failure, followed by reference tables for logon types and failure codes.
  • Read-only – The automation changes nothing on the domain controller. The only thing it writes is the last run time custom field.

Important Caveats & Behavior​

  • Only the monitored domain controller's own failed logons are counted – Windows records event 4625 on the computer where the logon was attempted. The solution reads only the Security log of the domain controller that holds the Infrastructure Master role, so it counts failed logons to that server, such as Remote Desktop, file share access and VPN or RADIUS logons handled by that server. A domain user who mistypes a password at a workstation or member server is recorded on that computer, not as event 4625 on the domain controller. Kerberos pre-authentication failures (event 4771) and NTLM credential validation failures (event 4776) are different events and are not counted.
  • One domain controller per domain – The compound condition runs only where cPVAL Roles Detected contains Infrastructure Master, which is one domain controller in each domain. Other domain controllers are not monitored.
  • Depends on Server Roles Detection – cPVAL Roles Detected is filled in by Server Roles Detection and Grouping for NinjaOne. If that solution is not implemented, no device is monitored. When the Infrastructure Master role moves to another domain controller, monitoring follows only after Server Roles Detection runs again, and the first run on the new domain controller checks only the last 60 minutes.
  • The threshold is a total per run, not per user – The alert is raised when the failed logons since the last run, from all users and all sources added together, are equal to or greater than the threshold. With the default threshold of 10 and the 4-hour schedule, that means 10 or more failed logons in 4 hours. If the schedule changes, review the threshold too.
  • Exclusions are applied before counting – Excluded failures never count toward the threshold and do not appear in the ticket. Broad entries such as *\*, DOMAIN\* for the monitored domain, or the NtLmSsp and User32 logon processes hide real attacks. See Exclusion Options.
  • A lower-level custom field value replaces the inherited one – For the exclusion fields, a value set on a location or device replaces the organization's value instead of adding to it. To keep the organization's entries on that device, include them in the device's value as well.
  • Parameters in the compound condition override the custom fields – The automation's parameters are left empty in the compound condition so that the custom fields are used. A value entered there applies to every device in the policy and replaces the custom field value, rather than adding to it.
  • The last run time field must be writable – cPVAL Excessive Logon LastRunTime must be a Device-level Text field with Read/Write automation access. If the script cannot save the time, every run checks only the last 60 minutes, so with a 4-hour schedule about 3 of every 4 hours are never checked.
  • The first run checks only the last 60 minutes – The same applies whenever the last run time field is empty or does not hold a valid past time.
  • Manual runs move the last run time – Running the automation by hand saves a new last run time, so the next scheduled run counts only the failures after the manual run. Failures counted by a manual run do not create a ticket, because only the compound condition creates tickets.
  • The Security log must hold at least 4 hours of events – Failed logons that roll out of the Security log before the next run are never counted. On a busy domain controller, make sure the maximum log size is large enough to hold more than 4 hours of events.
  • A Security log read failure also creates a ticket – If the Security log cannot be read, the script ends with Failure: Unable to read the Security log, which meets the compound condition, so a ticket is created. The last run time is not updated, so the next successful run covers the missed period.
  • Failed logons are listed on every run, but only the threshold creates a ticket – Whenever any failed logons are counted, the details appear in the device's activities, even when the count stays below the threshold.
  • Auto-reset is off – The compound condition is not set to reset on its own. Once it raises an alert on a device, it does not raise another one on that device until the alert is reset in NinjaOne. Reset the alert after the ticket has been worked. If the condition triggers again while the ticket is still open, the new output is appended to that ticket.
  • The ticket template needs a ticket type – The Excessive Logon Failures template ships with the type set to MUST CHANGE. Set the board, type and other values to match the partner's ConnectWise Manage before use.
  • Remove the previous condition when upgrading – The earlier version of this solution used a script result condition named Excessive Logon Attempts. Remove it from every agent policy before adding the compound condition. Both would save the same last run time, so each would count only the failures since the other last ran, and the threshold would rarely be reached.
  • Nothing is blocked or locked – The solution only reports. It does not block IP addresses, lock accounts or reset passwords.

How It Works​

  1. Server Roles Detection and Grouping for NinjaOne detects the roles on each Windows server and saves them in cPVAL Roles Detected. On the domain controller that holds the Infrastructure Master role, the field contains Infrastructure Master.
  2. Every 4 hours, the Monitor - Excessive Logon Attempts compound condition in the Windows Server Policy checks that cPVAL Roles Detected contains Infrastructure Master and that cPVAL Enable Excessive Logon Detection is not Disable.
  3. The compound condition runs the Excessive Logon Attempts automation as System. Its parameters are empty, so the automation reads the threshold and the exclusions from the cPVAL Excessive Logon custom fields.
  4. The automation reads the time saved in cPVAL Excessive Logon LastRunTime and collects the event ID 4625 entries from that time up to the moment the run started. If no valid time is saved, it collects the last 60 minutes.
  5. It drops batch and service logons, computer accounts failing from their own workstation and every failure that matches an exclusion, and counts the rest.
  6. It saves the time the run started in cPVAL Excessive Logon LastRunTime, so the next run starts where this one ended.
  7. If any failures were counted, it lists them in the output, grouped by user, domain and source IP address.
  8. If the count is equal to or greater than the threshold, the output ends with a Failure: line and exit code 1. The compound condition then triggers and creates a ConnectWise Manage ticket from the Excessive Logon Failures template, with the script output in the ticket. Otherwise, the output ends with a Success: line and no ticket is created.

Exclusion Options​

Five custom fields control which failed logons are ignored. Use the narrowest field that covers the failure, so that the same account failing anywhere else still counts.

MatchesBest forExample
cPVAL Excessive Logon ExcludeUsersThe username, in every domain and from every computerAccounts that fail harmlessly everywhere, such as a scanner accountscanner; svc_*
cPVAL Excessive Logon ExcludeByComputerAn account whose domain or source workstation is the named computerA local account that is only expected to fail on or from one PCFRONTDESK-01\reception
cPVAL Excessive Logon ExcludeByDomainAn account that belongs to the named domainOne domain's account, while the same name in another domain still alerts, or a whole domain that does not need monitoringCONTOSO\svc_scan
cPVAL Excessive Logon ExcludeByWorkstationAn account failing from the named workstationA device known to send bad logons, such as a copier or a laptop with an old saved passwordCOPIER-2F\scan2folder
cPVAL Excessive Logon ExcludeLogonProcessA kind of logon, whatever the accountFailures monitored elsewhere, such as VPN or RADIUS logonsCHAP

How to choose:

  • Pick ExcludeUsers only when the account is harmless wherever it fails.
  • Pick ExcludeByComputer, ExcludeByDomain or ExcludeByWorkstation when the failures are expected from one place only.
  • Pick ExcludeLogonProcess only for a whole kind of logon, and never for NtLmSsp or User32, which carry most password-guessing attacks.
  • Prefer naming a specific account over COMPUTER\* or WORKSTATION\*. The workstation name is reported by the computer making the attempt, so an attacker's computer can report a name that matches an entry.

Separate entries with commas, semicolons or line breaks. Matching is not case-sensitive. The ExcludeBy fields take SCOPE\account pairs, and a forward slash also works.

Prerequisites​

  • Server Roles Detection and Grouping for NinjaOne implemented, with its automation scheduled to run daily so cPVAL Roles Detected stays current
  • The ConnectWise Manage app enabled and connected in NinjaOne
  • Logon failure auditing enabled on the domain controllers, so Windows records event ID 4625. Windows Server enables it by default, but a Group Policy can turn it off. Running auditpol /get /subcategory:"Logon" on the domain controller should show Failure or Success and Failure.
  • PowerShell 5.1 on the domain controllers
  • A Security log large enough to hold more than 4 hours of events

Associated Content​

Custom Fields: Enablement and Threshold​

NameLevelTypePurpose
cPVAL Enable Excessive Logon DetectionOrganization, Location, DeviceDrop-downTurns monitoring on or off. Disable stops the compound condition from running on the device. Empty works like Enable.
cPVAL Excessive Logon ThresholdOrganization, Location, DeviceTextNumber of failed logons since the last run that raises the alert. Empty, 0, a negative number or text uses 10.

Custom Fields: Exclusions​

NameLevelTypePurpose
cPVAL Excessive Logon ExcludeUsersOrganization, Location, DeviceMulti-lineUsernames to ignore everywhere.
cPVAL Excessive Logon ExcludeByComputerOrganization, Location, DeviceMulti-lineCOMPUTER\account entries to ignore on or from one computer.
cPVAL Excessive Logon ExcludeByDomainOrganization, Location, DeviceMulti-lineDOMAIN\account entries to ignore in one domain.
cPVAL Excessive Logon ExcludeByWorkstationOrganization, Location, DeviceMulti-lineWORKSTATION\account entries to ignore from one workstation.
cPVAL Excessive Logon ExcludeLogonProcessOrganization, Location, DeviceTextLogon process names to ignore everywhere.

Custom Field: State​

NameLevelTypePurpose
cPVAL Excessive Logon LastRunTimeDeviceTextTime the automation last ran. Read and written by the automation on every run. Does not need to be filled in manually.

Automation​

NamePurpose
Excessive Logon AttemptsCounts the failed logons recorded since the last run, applies the exclusions, lists the failures and ends with Failure: when the count reaches the threshold.

Compound Condition​

NameTypePurpose
Monitor - Excessive Logon AttemptsCompound ConditionRuns the automation every 4 hours on the domain controller holding the Infrastructure Master role, unless monitoring is set to Disable, and creates a ConnectWise Manage ticket when the threshold is reached.

Ticket Template​

NamePurpose
Excessive Logon FailuresSets the board, priority and title of the ConnectWise Manage ticket created by the compound condition.

Dependencies​

NameTypePurpose
Server Roles Detection and Grouping for NinjaOneSolutionFills in cPVAL Roles Detected, which the compound condition uses to find the Infrastructure Master.

Implementation​

Step 1: Implement Server Roles Detection​

Implement Server Roles Detection and Grouping for NinjaOne if it is not already in place. Confirm that cPVAL Roles Detected contains Infrastructure Master on the domain controller that holds the role.

Step 2: Create the Custom Fields​

Create all nine custom fields. Give cPVAL Excessive Logon LastRunTime Read/Write automation access, as the automation saves the last run time in it.

Step 3: Create or Update the Automation​

Create the automation and set it to run as System. When upgrading, replace the existing automation. The Minutes parameter has been removed, Threshold is now optional, and five exclusion parameters have been added.

Step 4: Create the Ticket Template​

Create the ticket template, then set the board, type, team and other values to match the partner's ConnectWise Manage. The type is shipped as MUST CHANGE and must be replaced.

Step 5: Create the Compound Condition​

Create the compound condition in the Windows Server Policy, or in the policy the domain controllers use. Leave every automation parameter empty so the custom fields are used.

Step 6: Remove the Previous Condition (Upgrades Only)​

If the earlier version of this solution was implemented, remove the Excessive Logon Attempts script result condition from every agent policy that has it, such as Windows Server [Default]. Leaving it in place splits the last run time between two conditions and can create duplicate tickets.

Step 7: Set the Threshold and Exclusions (Optional)​

Leave cPVAL Excessive Logon Threshold empty to use the default of 10, or set a higher value for a busy domain controller. Add exclusions only for failures that have been investigated and confirmed harmless. To turn monitoring off for a client, location or domain controller, set cPVAL Enable Excessive Logon Detection to Disable at that level.

You'll know it worked when, within 4 hours of saving the policy, cPVAL Excessive Logon LastRunTime on the Infrastructure Master shows a time such as 2026-11-11 10:21:03 -05:00, and the device's activities show the automation output ending in a Success: or Failure: line with the period it checked.

Troubleshooting​

No Ticket Is Created​

  • Review the automation output in the device's activities. A Success: line means the count stayed below the threshold. The line shows how many failures were counted, the period checked and the threshold used.
  • Confirm cPVAL Enable Excessive Logon Detection is not Disable at the organization, location or device level.
  • Confirm cPVAL Roles Detected contains Infrastructure Master on the device. If the role has moved, run Server Roles Detection again.
  • Confirm the compound condition is in the agent policy assigned to the domain controller.
  • Confirm the ConnectWise Manage app is connected, and that the Excessive Logon Failures template has a valid board and type.
  • Check whether an earlier alert from the compound condition is still active on the device. Until it is reset, the condition does not raise a new alert.
  • Check that the exclusions are not too broad, including values set at the location and device levels.
  • Check whether the previous Excessive Logon Attempts condition is still in a policy. It moves the last run time, so the compound condition counts only a few minutes of failures.
  • Confirm Windows is recording the events. On the domain controller, auditpol /get /subcategory:"Logon" should show Failure, and Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4625 } -MaxEvents 20 should return recent failures.
  • Confirm the Security log keeps more than 4 hours of events. If its oldest event is less than 4 hours old, increase the maximum log size.
  • If the activity shows the automation stopped at the timeout, the last run time was not saved and the next run covers the same period again. Increase the timeout in the compound condition.

Investigating an Alert​

Reading the Alert​

Each row in the alert is one combination of user, domain and source IP address. The details come from the most recent failure in that group.

FieldWhat it shows
UserName / DomainThe account that failed. For a local account, Domain is the computer the account belongs to.
LogonTypeHow the logon was attempted: 2 Interactive, 3 Network, 7 Unlock, 8 NetworkCleartext, 9 NewCredentials, 10 RemoteInteractive (Remote Desktop), 11 CachedInteractive.
WorkstationNameThe computer the attempt came from, as reported by that computer. It can be empty or -.
SourceIpAddressThe IP address the attempt came from. - or a loopback address means the attempt started on the domain controller itself.
FailureStatus / FailureSubStatusWhy the logon failed. Compare FailureSubStatus, or FailureStatus when there is no sub-status, with the error code table.
CallerProcessName / CallerProcessStatusThe process on the domain controller that requested the logon, and whether it is still running.
LogonProcess / AuthenticationPackageThe Windows component and protocol that handled the attempt, such as NtLmSsp and NTLM, or CHAP for VPN and RADIUS.
Occurrences / MostRecentDetectionHow many failures the group had in the period, and when the newest one happened.

Common Patterns​

What the alert showsLikely cause
Many different usernames from one source IP address, often with 0xC0000064Account enumeration or password spraying
One account with many occurrences and 0xC000006A from one sourceAn old saved password on a device, mapped drive, phone or service, or a brute-force attack on that account
LogonType 3 or 10 from a public IP addressFile sharing or Remote Desktop exposed to the internet
LogonProcess CHAPVPN or RADIUS users entering a wrong password
SourceIpAddress - or loopback with an application as CallerProcessNameAn application or service on the domain controller using wrong credentials

1. Identify the Account Type​

  • Domain Account: Check in Active Directory Users and Computers (ADUC).
  • Local Account: Use Computer Management > Local Users and Groups.
  • Service Account: Check the services, scheduled tasks and applications that use the account.
  • Unknown Account: Investigate for potential brute-force or enumeration attacks.

2. Review the Event Logs​

Look for event ID 4625 in the Security log of the domain controller, and pay attention to:

  • Status and SubStatus codes
  • Logon type
  • Source IP address and workstation
  • Target account name

3. Error Codes​

Error CodeMeaningAction Steps
0xC000006ABad password
  1. Check if the password was recently changed.
  2. Reset the password if needed.
  3. Investigate repeated attempts (possible brute-force or excessive logon attempts).
0xC000006DBad username or authentication information
  1. Check FailureSubStatus for the specific reason.
  2. Verify the username.
  3. Check for typos or outdated credentials.
  4. Investigate the source of repeated failures.
0xC0000064Bad or misspelled username
  1. Confirm the account exists.
  2. Investigate for enumeration attempts.
0xC000005ENo logon servers available
  1. Check domain controller availability.
  2. Ensure network connectivity.
  3. Restart the Netlogon service.
0xC000006FLogon outside authorized hours
  1. Review account restrictions in AD.
  2. Adjust allowed logon hours if needed.
0xC0000070Unauthorized workstation
  1. Check workstation restrictions in AD.
  2. Update allowed workstations.
0xC0000071Expired password
  1. Have the user change the password.
  2. Update the password everywhere it is saved.
0xC0000072Account disabled
  1. Investigate why the account was disabled.
  2. Enable the account in AD if it should be in use, or remove the saved credentials.
0xC0000133Clock out of sync with the domain controller
  1. Check the time on the source computer and the domain controller.
  2. Fix time synchronization.
0xC000015BLogon type not granted
  1. Check Group Policy or Local Security Policy.
  2. Grant appropriate logon rights.
0xC0000192Netlogon service not started
  1. Start the Netlogon service.
  2. Set it to automatic.
0xC0000193Expired account
  1. Extend or renew the account expiration date.
0xC0000224Password must be changed at next logon
  1. Have the user sign in interactively and change the password.
0xC0000234Account locked out
  1. Find the source of the failures before unlocking.
  2. Unlock the account once the source is fixed.
0xC0000413Authentication firewall restriction
  1. Review firewall or security policies.
  2. Allow the account to authenticate.

For the full list, see Microsoft's event 4625 reference.

4. Service Account Checks​

Run these on the computer the failures come from, shown in WorkstationName or SourceIpAddress:

  • Services: Get-CimInstance -ClassName Win32_Service | Where-Object { $_.StartName -like '*accountname*' } | Select-Object Name, StartName, State
  • Scheduled tasks: Get-ScheduledTask | Where-Object { $_.Principal.UserId -like '*accountname*' } | Select-Object TaskName, TaskPath

Then change the password in AD and update it in every service, scheduled task and application that uses it.

5. Unknown or Suspicious Accounts​

  • Investigate the source IP address: Use firewall logs or SIEM tools.
  • Check for patterns: Repeated failures from the same IP address, or failures targeting many accounts.
  • Block the IP address or account: If the activity is malicious, take immediate action.
  • Enable account lockout policies: To limit brute-force attempts.

FAQ​

Q: The device's activities list failed logons, but no ticket was created. Why?​

The automation lists the failures on every run that counts any, but a ticket is created only when the count is equal to or greater than the threshold. The last line of the output shows the count, the period checked and the threshold.

Q: How do I change the threshold?​

Set cPVAL Excessive Logon Threshold at the organization, location or device level. The value is a total across all users for the period since the last run, which is 4 hours on the default schedule. A good way to pick a value is to review the failures listed in the device's activities for a week and set the threshold above the normal level.

Q: How do I turn monitoring off for a client, a location or one domain controller?​

Set cPVAL Enable Excessive Logon Detection to Disable at that level. A value set at a lower level overrides the inherited one, so a single domain controller can be excluded while the rest of the client stays monitored.

Q: Which exclusion field should I use?​

Use the narrowest one that covers the failure. See Exclusion Options for a comparison.

Q: I excluded an account at the organization level, but it still appears in alerts for one domain controller. Why?​

The exclusion field has a value at the location or device level, which replaces the organization's value instead of adding to it. Add the organization's entries to the lower-level value as well, or clear the lower-level value.

Q: A user locked themselves out at their workstation. Why was there no alert?​

Windows records event 4625 on the computer where the logon was attempted, which was the workstation. The domain controller records that failure as event 4771 or 4776, which this solution does not count. The solution counts only failed logons to the domain controller that holds the Infrastructure Master role.

Q: Why is only one domain controller monitored?​

The compound condition runs only where cPVAL Roles Detected contains Infrastructure Master. There is one Infrastructure Master in each domain, so one domain controller per domain is monitored.

Q: Can I run the automation manually?​

Yes, but a manual run saves a new last run time. The next scheduled run then counts only the failures after the manual run, and the failures the manual run counted do not create a ticket.

Q: Why did the first run check only the last 60 minutes?​

cPVAL Excessive Logon LastRunTime was empty. From the second run onward, each run covers the time since the previous run.

Q: Can I run the check more or less often than every 4 hours?​

Yes. Change the Run every interval of the compound condition. Each run still covers the time since the previous run, so nothing is missed or counted twice. Review the threshold at the same time, as it applies to the period between runs.

Q: What happened to the Minutes parameter?​

It was removed. The automation now counts the failures since its last run, saved in cPVAL Excessive Logon LastRunTime, instead of a fixed number of minutes.

Q: I received a ticket that says "Unable to read the Security log". What does it mean?​

The automation could not read the Security log, so it ended with a Failure: line and the compound condition created a ticket. The reason is shown after the message. Check that the Windows Event Log service is running and that the Security log is not damaged. The last run time was not updated, so the next successful run covers the missed period.

Q: The output shows "[WARNING] Unable to save ... as the last run time". What should I do?​

Make sure cPVAL Excessive Logon LastRunTime exists as a Device-level Text field with Read/Write automation access. Until the time can be saved, each run checks only the last 60 minutes.

Q: Why is the total of the Occurrences column lower than the count in the Failure line?​

Failures that have no username are counted toward the threshold but are not listed in the details.

Q: Why don't failures from services, scheduled tasks or computer accounts appear?​

Batch logons (logon type 4, used by scheduled tasks), service logons (logon type 5) and a computer account failing from its own workstation are never counted.

Q: Does the solution block the attacker or lock the account?​

No. It only reports. Blocking IP addresses, locking accounts and resetting passwords are left to the technician working the ticket.

Q: I implemented the previous version of this solution. What do I need to change?​

Changelog​

2026-11-11​

  • Rewrote the document to the current solution template, adding Key Capabilities, Important Caveats & Behavior, How It Works, Exclusion Options, Prerequisites, step-by-step Implementation, FAQ and expanded Troubleshooting.
  • Replaced the Excessive Logon Attempts condition with the Monitor - Excessive Logon Attempts compound condition, which runs every 4 hours on the domain controller holding the Infrastructure Master role.
  • Added the enablement, threshold, exclusion and last run time custom fields.
  • Updated the automation to count the failures since its last run instead of a fixed Minutes window, and to apply the new exclusions.
  • Renamed the ticket template to Excessive Logon Failures.

2025-07-09​

  • Initial version of the document