{"id":2720,"date":"2024-04-13T03:16:12","date_gmt":"2024-04-13T01:16:12","guid":{"rendered":"https:\/\/itsimple.info\/?p=2720"},"modified":"2024-04-13T03:16:21","modified_gmt":"2024-04-13T01:16:21","slug":"how-to-configure-an-alert-on-active-directory-user-locked-out-and-how-to-find-whats-locking-out-an-ad-account-using-native-auditing","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=2720","title":{"rendered":"How to configure an alert on Active Directory User Locked Out and How To Find what&#8217;s locking out an AD account using native auditing"},"content":{"rendered":"\n<p>First you need to set the Number of failed login attempt using GPMC (Group policy management ) , The location of the key is :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Computer Configuration -> Windows Settings -> Security Settings -> Account Policies -> Account Lockout Policy<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"856\" height=\"277\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutSettings.png\" alt=\"\" class=\"wp-image-2722\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutSettings.png 856w, https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutSettings-300x97.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutSettings-768x249.png 768w\" sizes=\"auto, (max-width: 856px) 100vw, 856px\" \/><\/figure>\n\n\n\n<p>Then you need to to enable user login auditing using the GPMC<\/p>\n\n\n\n<p>Perform the following actions on the domain controller (DC):<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the <strong>Start<\/strong> menu. Search for and open the <strong>Group Policy Management Console<\/strong> (GPMC). You can also run the command <strong><em>gpmc.msc<\/em><\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-01.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-01.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Right-click the <strong>domain<\/strong> or <strong>organizational unit (OU)<\/strong> where you want to audit account lockouts, and click <strong>Create a GPO in this domain, and Link it here<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p><strong>Note<\/strong>: If you have already created a GPO, click <strong>Link an Existing GPO<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-02.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-02.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Name the <strong>GPO<\/strong>.<\/li>\n\n\n\n<li>Right-click the <strong>GPO<\/strong> and choose <strong>Edit<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-03.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-03.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>In the left pane of the <em>Group Policy Management Editor<\/em>, navigate to <strong>Computer Configuration &gt; Policies &gt; Windows Settings &gt; Security Settings &gt; Advanced Audit Policy Configuration &gt; Audit Policies &gt; Account Management<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-04.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-04.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\">\n<li>In the right pane, you will see the list of policies under <em>Account Management<\/em>. Double-click <strong>Audit User Account Management<\/strong> and check the boxes labeled <strong>Configure the following audit events, Success<\/strong>, and <strong>Failure<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-05.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-05.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"7\">\n<li>Click <strong>Apply<\/strong> and then <strong>OK<\/strong>.<\/li>\n\n\n\n<li>Go back to the <strong>Group Policy Management Console<\/strong>. In the left pane, right-click the <strong>domain<\/strong> or <strong>OU<\/strong> that the GPO was linked to and click <strong>Group Policy Update<\/strong>. This step makes sure the new Group Policy settings are applied instantly instead of waiting for the next scheduled refresh.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-06.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-06.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to view the logged events in the Event Viewer<\/h2>\n\n\n\n<p>Once the above steps are complete, events will be logged in the event log. These can be viewed in the Event Viewer by following the steps below:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the <strong>Start<\/strong> menu, search for <strong>Event Viewer<\/strong>, and click to open it.<\/li>\n\n\n\n<li>In the left pane of the Event Viewer window, navigate to <strong>Windows Logs &gt; Security<\/strong>. Here, you will find a list of all the <strong>security events<\/strong> that are logged in the system.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-07.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-07.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>In the right pane under <em>Security<\/em>, click <strong>Filter Current Log<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-08.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-08.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>In the pop-up window, enter <strong>4740<\/strong> in the field labeled <strong>&lt;All Event IDs&gt;<\/strong>.<\/li>\n\n\n\n<li>Click <strong>OK<\/strong>. This will provide a list of occurrences of the Event ID you entered.<\/li>\n\n\n\n<li>Double-click the Event ID to view its <strong>properties<\/strong> (description).<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-09.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-09.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<p>In the event description, the Caller Computer Name is shown.<\/p>\n\n\n\n<p>To perform a more detailed analysis of the cause of this lockout, carry out the following actions on the DC:<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"1\">\n<li>In the <em>Event Viewer<\/em>, filter the current view to look for the <strong>Event ID 4625<\/strong>, which is logged when there is a failed logon.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-10.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-10.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>On the right pane of the Event Viewer window, click <strong>Find<\/strong>, enter the name of the user that was locked out, and click <strong>Find Next<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-11.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-11.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Look for an event that was logged after the account lockout time and view its properties.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-12.png\"><img decoding=\"async\" src=\"https:\/\/www.manageengine.com\/products\/active-directory-audit\/how-to\/images\/find-out-what-is-locking-ad-account-12.png\" alt=\"How to find what's locking out an Active Directory account\"\/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Scroll down to <strong>Caller Process Name<\/strong>. This will show you the location of the process that possibly caused the lockout.<\/li>\n<\/ol>\n\n\n\n<p>Now you need a Powershell script to check is there is locked out users and send you email alert :<\/p>\n\n\n\n<p>powershell<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># SMTP Server Configuration\n$SmtpServer = \"smtp.your_server_name\"\n$SmtpUsername = \"User Name\"\n$SmtpPassword = \"Password\"\n$From = \"Sender_email\"\n$To = \"recipient_email\"\n$Subject = \"Active Directory Locked Out User Alert !\"\n\n# Get locked out users\n$LockedOutUsers = Search-ADAccount -LockedOut | Select-Object Name, SamAccountName, UserPrincipalName, LockedOut\n\n# If there are locked out users, send an email alert\nif ($LockedOutUsers) {\n    $Body = \"The following users are locked out:`n`n\"\n    foreach ($user in $LockedOutUsers) {\n        $Body += \"Name: $($user.Name)`n\"\n        $Body += \"Username: $($user.SamAccountName)`n\"\n        $Body += \"User Principal Name (UPN): $($user.UserPrincipalName)`n\"\n        $Body += \"Locked Out: $($user.LockedOut)`n`n\"\n    }\n\n    # Send email\n    $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $SmtpUsername, (ConvertTo-SecureString -String $SmtpPassword -AsPlainText -Force)\n    Send-MailMessage -SmtpServer $SmtpServer -From $From -To $To -Subject $Subject -Body $Body -Credential $Credential -UseSsl -Port 587\n}\nelse {\n    Write-Host \"No locked out users found.\"\n}<\/code><\/pre>\n\n\n\n<p>This script use smtp with SSL through port 587, you can delete the &#8220;-UseSsl&#8221; and change the port to 25 in the script in order to be more soft<\/p>\n\n\n\n<p>And the last this is to set up Task Schedule with alert as a trigger to run this script , from event Viewer, under security, find the event ID 4740 &#8220;A user account was locked out&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"435\" height=\"256\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutEventTriger.png\" alt=\"\" class=\"wp-image-2724\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutEventTriger.png 435w, https:\/\/itsimple.info\/wp-content\/uploads\/2024\/04\/AcountLockedOutEventTriger-300x177.png 300w\" sizes=\"auto, (max-width: 435px) 100vw, 435px\" \/><\/figure>\n\n\n\n<p> Flow the wizard to the ens and adjust the task to your need , Here you can find more information to do that :<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed is-provider-sharepoint-diary wp-block-embed-sharepoint-diary\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"QztyGrWqd5\"><a href=\"https:\/\/www.sharepointdiary.com\/2013\/03\/create-scheduled-task-for-powershell-script.html\">Create a Scheduled Task to Run PowerShell Script<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Create a Scheduled Task to Run PowerShell Script&#8221; &#8212; SharePoint Diary\" src=\"https:\/\/www.sharepointdiary.com\/2013\/03\/create-scheduled-task-for-powershell-script.html\/embed#?secret=gxxfi0uH9c#?secret=QztyGrWqd5\" data-secret=\"QztyGrWqd5\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-pullquote has-vivid-green-cyan-color has-text-color has-link-color has-large-font-size wp-elements-fe15915abd78eb3f2e62c4c20c80165c\"><blockquote><p>Good luck<\/p><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>First you need to set the Number of failed login attempt using GPMC (Group policy management ) , The location of the key is : Computer Configuration -> Windows Settings -> Security Settings -> Account Policies -> Account Lockout Policy Then you need to to enable user login auditing using the GPMC Perform the following [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,12,14],"tags":[],"class_list":["post-2720","post","type-post","status-publish","format-standard","hentry","category-operating-systems","category-tutorials","category-windows"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2720"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2720\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}