Skip to content

IT-Admins

a website from a systems administrator for systems administrators

    • Home
    • IT-Admins CMDB
      • ITAM – Features
      • ITAM – Release Notes
      • ITAM – Download
      • ITAM – Installation
      • ITAM – Online Manual
        • ITAM – General Functions
        • ITAM – Settings
        • ITAM – Common Modules
          • ITAM – Main Page
          • ITAM – Workstations
          • ITAM – Monitors
          • ITAM – Printers
          • ITAM – Toner-Inventory
          • ITAM – Servers
          • ITAM – Infrastructure Assets
          • ITAM – Other Assets
          • ITAM – Purchases
          • ITAM – Employees
          • ITAM – Software
          • ITAM – Projects and Project Tasks
          • ITAM – Phones/DIDs
          • ITAM – IP Addresses
          • ITAM – Responsibility Matrix
          • ITAM – IT Supplies
        • ITAM – Less Common Modules
          • ITAM – Departments
          • ITAM – Vendors
          • ITAM – Expenses
          • ITAM – Checklist Templates
          • ITAM – LDAP Groups
          • ITAM – Phones and Phone Models
          • ITAM – Links
          • ITAM – Reminders
          • ITAM – Printer Models and Supplies
          • ITAM – VLANs
          • ITAM – Databases
          • ITAM – WebServer
          • ITAM – Certificates
          • ITAM – DNS Entries and Zones
        • ITAM – Research Modules
          • ITAM – TAGs
          • ITAM – Notes
          • ITAM – Checklists
          • ITAM – Incidents
          • ITAM – MAC address search
          • ITAM – LDAP sync Log
          • ITAM – WMI Log
          • ITAM – LDAP compare
          • ITAM – Service Log
    • IT-Admins tool
      • IT-Admins Tool – Features
      • IT-Admins Tool – Scenarios
      • IT-Admins Tool – Screenshots
      • IT-Admins Tool – Release notes
      • FAQ
      • IT-Admins Tool – Download
      • IT-Admins Tool – Online Manual
        • IT-Admins Tool – Overview
        • IT-Admins Tool – Generic search functions
        • IT-Admins Tool – Configuration
        • IT-Admins Tool – Domain Users
        • IT-Admins Tool – Domain Groups
        • IT-Admins Tool – Domain Computers
        • IT-Admins Tool – Domain Contacts
        • IT-Admins Tool – NTFS ACLs
        • IT-Admins Tool – Long Paths
        • IT-Admins Tool – Directory compare
        • IT-Admins Tool – Search function
    • IT Search
      • IT Search – How it works
      • IT Search – Release Notes
      • IT Search – Download
      • IT Search – Installation
      • IT Search – Online Manual
        • Applying updates
        • Search Providers
        • Configuration
        • Error Log viewer
        • Active Users
        • Monitoring and Statistics
        • Backup and Restore
    • EOL Solutions
      • IT Printer Management (EOL)
        • Printer Management EOL – Installation
        • Printer Management EOL – Download
        • Printer Management EOL – Online Manual
          • Printer Management EOL – Executing the script
          • Printer Management EOL – Using the Sys-Search
          • Printer Management EOL – Managing printers
          • Printer Management EOL – Reviewing the log
          • Printer Management EOL – User to printer (v2)
          • Printer Management EOL – Computer to printer (v2)
      • IT Assets Database (EOL)
        • IT Assets DB Video
        • EOL Asset DB – Features
        • EOL Asset DB – Installation
        • EOL Asset DB – Release Notes
        • EOL Asset DB – Update to the newest version
        • EOL Asset DB – Download
        • EOL Asset DB – Online manual
          • EOL Asset DB – Overview
            • EOL Asset DB – The floating / roaming task execution
          • EOL Asset DB – Using the the sys search
          • EOL Asset DB – Main menu
          • EOL Asset DB – Workstations
          • EOL Asset DB – Monitors
          • EOL Asset DB – Departments
          • EOL Asset DB – Printers
            • EOL Asset DB – Printer models and supplies
            • EOL Asset DB – Toner inventory
          • EOL Asset DB – Incidents
          • EOL Asset DB – Software and licenses
          • EOL Asset DB – LDAP change reporting / synchronization
            • EOL Asset DB – Employees
            • EOL Asset DB – LDAP Groups
          • IP addresses – IPAM
          • EOL Asset DB – DNS management
          • EOL Asset DB – Servers and equipment
            • EOL Asset DB – databases
            • EOL Asset DB – backup reviews
            • EOL Asset DB – Certificate management
            • EOL Asset DB – Webserver Management
          • EOL Asset DB – Vendors and contacts
          • EOL Asset DB – Links and URLs
          • EOL Asset DB – Reminders
          • EOL Asset DB – Purchases
          • EOL Asset DB – Expenses
    • Current Page Parent Blog
    • Contact
    • Links

    Amount of locked out accounts

    It is a good to know how many of your user accounts are locked out right now… I would go as far as saying you should monitor this and have alert levels on it, cause this could indicate and reveal a brute-force like attack against your system.

    Doing it manually in a PowerShell (assuming you have RSAT / Active-Directory PowerShell modules installed) can be done with the following command that will show you who is locked out and the calculated amount as well..

    lockouts - simple PS commands
    PowerShell
    1
    2
    3
    $s=Search-ADAccount -LockedOut |ft
    $s
    'CurrentCount: ' + $s.count

    Using PRTG you can add the following advanced script

    Get-LDAPLockoutCount.ps1
    PowerShell
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    Import-module activedirectory
    $Count=-1
     
    $Accounts = Search-ADAccount -LockedOut
    $Count=$Accounts.Count
     
    $Users = ""
    foreach ($user in $Accounts) {
    if ($Users.Length -gt 0) {
    $Users += " / "
    }
    $Users += $user.SamAccountName
    }
     
    $XML =  "<prtg>"
    $XML += "<result><channel>LDAP accounts locked out</channel><value>$Count</value><unit>Count</unit></result>"
    $XML += "<text>$Users</text>"
    $XML += "</prtg>"
     
    Function WriteXmlToScreen ([xml]$xml)
    {
        $StringWriter = New-Object System.IO.StringWriter;
        $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter;
        $XmlWriter.Formatting = "indented";
        $xml.WriteTo($XmlWriter);
        $XmlWriter.Flush();
        $StringWriter.Flush();
        Write-Output $StringWriter.ToString();
    }
     
    WriteXmlToScreen $XML

    After adding it as a sensor, it will create a single channel with the amount of locked out users. You should set error limits:

    • minimum error limit: 0
      • the script returns -1 if an error occurred
    • maximum error limit: this depends on your user base – I would say about 5% of your users – no more.. depends as well on the lockout-duration in your security policy…

    The advantage of the script in PRTG is – it always reports back additional text – the currently locked out SamAccount names.. respective user-names.. so in case it generates an error – you will see some more information…

    Assuming there is a brute-force, you might see this sparking and going down – meaning someone tries to find an entry account… since the lockout attribute causes an emergency-replication of your domain-controllers (this attribute bypasses the regular replication interval) you can fire it relatively simply against your domain, the script just uses the current logon domain of the executing user.

     

    Tags: accountactive directoryldaplockoutpowershellprtgsecurity

    October 25, 2019 by Florian Rossmark monitoring prtg security server

    You may also like...

    • Office 365/Exchange Public Folders – find out if they are still in use

      Office 365/Exchange Public Folders – find out if they are still in use

    • The advantage of DFS and how to set up a working structure

      The advantage of DFS and how to set up a working structure

    • PRTG sensor to monitor a directory for a specific file type and minimum size and age

      PRTG sensor to monitor a directory for a specific file type and minimum size and age

    • Next PRTG and Cisco ASA VPN monitoring
    • Previous RDS – Fix broken local RDS links in start menu

    Recent blog posts

    • PRTG sensor to monitor a directory for a specific file type and minimum size and age February 15, 2023
    • APC NetBotz 250 SNMP monitoring with PRTG December 6, 2022
    • Linux and DHCP reservations aren’t working June 28, 2022
    • Check your webpage for mobile friendly readiness June 15, 2022
    • Tools for WebAnalytics and SEO April 21, 2022

    Blog Archives

    Tags

    dhcp html excel office backup outlook rds ip sql monitoring dfs windows print automate notification veritas powershell backup exec slack password javascript ssl database SNMP cleanup web Office 365 website eventlog prtg security active directory script gpo vmware account filesystem UEFI server certificate lockout network ldap profile performance
    • Terms & Conditions
    • Privacy Policy
    • Opt-out preferences
    • SPICEWORKS
    • LOPSA
    • RSS
    • LinkedIn
    • ITML
    • XING

    IT-Admins © 2025. All Rights Reserved.

    Powered by WordPress. Theme by Alx.

      Manage Cookie Consent
      To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
      Functional Always active
      The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
      Preferences
      The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
      Statistics
      The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
      Marketing
      The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
      Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
      View preferences
      {title} {title} {title}