• Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
Wednesday, November 18, 2026
No Result
View All Result
Subscribe Now
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Trump Administration Revokes Pay Increase for Head Start Educators

    Trump Administration Revokes Pay Increase for Head Start Educators

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Exploring Diversity: ‘Ten Lives’ Showcases the Varied Economic Journeys of Americans

    Exploring Diversity: ‘Ten Lives’ Showcases the Varied Economic Journeys of Americans

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
The Insight Post
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Mary Peltola Emerges Victorious in Alaska Senate Race, Making History for Democrats

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Stranded in Conflict: Palestinians Navigate the Tenuous Balance of War and Peace Amid Ceasefire Efforts

    Trump Administration Revokes Pay Increase for Head Start Educators

    Trump Administration Revokes Pay Increase for Head Start Educators

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Unexpected Triumph: Gay Candidates Achieve Unforeseen Victories in Challenging Races

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Microsoft Outlook Experiences Prolonged Outage Affecting Users Nationwide

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    Gunfire Erupts in D.C.: Authorities Search for Suspect Amid Rising Concerns Over Public Safety

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    LAUSD Takes Strong Action Against Hate Speech Following Racial Slur Incidents

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Beloved Former Los Angeles Times Columnist Steve Harvey Passes Away at 80

    Exploring Diversity: ‘Ten Lives’ Showcases the Varied Economic Journeys of Americans

    Exploring Diversity: ‘Ten Lives’ Showcases the Varied Economic Journeys of Americans

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
No Result
View All Result
No Result
View All Result
Home Business Asia

How to fix Active Directory account lockouts with PowerShell

by Theinsightpost
December 12, 2022
in Business Asia
0 0
0
How to fix Active Directory account lockouts with PowerShell


Accidents can happen, but when it comes to failed login attempts, enough of them can freeze you out of your work laptop until someone from IT comes to the rescue.

Many organizations lock a user account after a set number of failed logon attempts. The goal is to prevent attacks from hackers who try brute force to find a user’s password. However, not all lockouts are from malicious sources or even by users who forget their passwords.

Applications can sometimes lead to account lockouts. Applications often rely on a service account for the necessary permissions to function. However, if the service account’s password changes and the application does not get the updated password, this can cause a lock on the service account.

Redundant logon information is also another common cause of account lockouts. An enterprise user might have a dozen or more sets of credentials tied to a common username. It takes some effort to keep track of all these accounts. It’s not difficult to foresee someone accidentally using the wrong set of credentials multiple times and causing an account lockout.

How to proactively avoid lockout issues using automation

Account lockouts can also occur when users change work locations. A common scenario is when a user switches from working on a domain-joined Windows desktop in the office to a different Windows machine at home that is not currently connected to a network. Because the laptop is offline, it has not recorded the password change. The user must log in with the old password. If the user brings the laptop into the office and attempts to access the network, then the password mismatch, combined with end-user confusion, could lead to an account lockout.

Why are account lockouts a problem for IT?

One of the main reasons why account lockouts tend to be so problematic is that they tend to happen silently. As an administrator, you might never even know that an account lockout has occurred unless a user calls or you see an account lockout event listed in the Windows event logs. However, you can use PowerShell automation to gain a better handle on account lockout events.

Search the event logs

To stay ahead of these lockout situations, one option is to use PowerShell to check for lockouts in event logs with the following command:

Get-WinEvent -FilterHashTable @{LogName="Security"; ID=4740} | Select-Object TimeCreated, Message | Format-Table -Wrap

The Get-WinEvent cmdlet queries event logs. The FilterHashTable portion specifies the items to search for within the logs. In this case, the LogName parameter points the Get-WinEvent cmdlet to search the Windows Security log. Additionally, the ID parameter looks for instances of Event ID 4740, which refers to account lockout events.

The results are then piped into the Select-Object cmdlet, which displays the event created time and the event message. Normally, PowerShell truncates the account lockout message, but the Format-Table cmdlet, along with the Wrap parameter, forces PowerShell to display all the pertinent information.

PowerShell lockout query
Use PowerShell to query the event logs and display Active Directory account lockout events.

In a production environment, this Active Directory account lockout query could return an excessive number of results because it checks the Security event log for all instances of Event ID 4740, regardless of when the event occurred. The best way to address this problem is to use the StartTime filter. For example, the following command looks at events that have occurred in the last 24 hours:

$Start=(Get-Date).AddDays(-1)
Get-WinEvent -FilterHashTable @{LogName="Security"; ID=4740;StartTime=$Start}
| Select-Object TimeCreated, Message | Format-Table -Wrap

The first command creates a variable named $Start and sets it to the previous 24 hours via AddDays(-1). To check the previous weeks’ worth of logs, use AddDays(-7).

The second command is identical to the earlier code except StartTime=$Start is added to the filter hash table. This instructs PowerShell to ignore results older than the date and timestamp in the $Start variable.

How to check an account’s lockout status

Another way PowerShell assists with Active Directory account lockouts is using the Get-ADUser cmdlet to check the lockout status of the account. Use the following command to retrieve attributes related to Active Directory user accounts.

Get-ADUser -Identity <username> -Properties * | Select-Object LockedOut, AccountLockoutTime, BadLogonCount

The Identity parameter specifies the account name for the user to investigate. In this case, retrieve all the account’s properties, and then use Select-Object cmdlet to display the lockout status, when the lockout occurred and the number of failed login attempts. Incidentally, the LockedOut property contains a value of true or false: A locked account shows true, while an unlocked one shows false.

To unlock an account, use the following PowerShell command, replacing <username> with the name of the user whose account you wish to unlock.

Unlock-ADAccount <username>
verify account status
Use PowerShell to check an account’s status and, if necessary, to unlock an account.

PowerShell’s Get-ADUser cmdlet retrieves a user’s account lockout status. In this case, a value of true indicates that the user’s account is locked. The Unlock-ADAccount cmdlet unlocks the account. You can use the Get-ADUser cmdlet to verify the unlock was successful.

PowerShell scripting can address wide-scale problems

PowerShell gives you the basic tools to detect and resolve account lockout events. You can use the commands and techniques in this article to build on and create automated scripts to help resolve account lockout events at scale.



Source link

ShareTweetSend
Previous Post

Home insurance costs increase across New Zealand – Consumer NZ

Next Post

Art brings awareness to crisis in Afghanistan

Related News

Business Asia

Tokayev Proposes Dipping Into National Fund to Turn Kazakhstan into a ‘Big Construction Site’ – The Diplomat

October 29, 2026
Business Asia

China Is Learning to Sell Japanese Culture Better Than Japan – The Diplomat

October 28, 2026
Business Asia

Indonesia Announces New Measures to Improve Stock Market Transparency – The Diplomat

October 27, 2026
Business Asia

Indonesia Reduces Gas Supply to Singapore, Citing Domestic Energy Needs – The Diplomat

October 26, 2026
Next Post
Art brings awareness to crisis in Afghanistan

Art brings awareness to crisis in Afghanistan

Discussion about this post

Subscribe To Our Newsletters

    Customer Support


    1251 Wilcrest Drive
    Houston, Texas
    77042 USA
    Call-832.795.1420
    e-mail – news@theinsightpost.com

    Subscribe To Our Newsletters

      Categories

      • Africa
      • Africa-East
      • African Sports
      • American Sports
      • Arts
      • Asia
      • Australia
      • Business
      • Business Asia
      • Business- Africa
      • Canada
      • Defense
      • Education
      • Egypt
      • Energy
      • Entertainment
      • Europe
      • European Soccer
      • Finance
      • Germany
      • Ghana
      • Health
      • Insight
      • International
      • Investing
      • Japan
      • Latest Headlines
      • Life & Living
      • Markets
      • Mobile
      • Movies
      • New Zealand
      • Nigeria
      • Politics
      • Scholarships
      • Science
      • South Africa
      • South America
      • Sports
      • Tech
      • Travel
      • Travel-Africa
      • UK
      • USA
      • Weather
      • World
      No Result
      View All Result

      Recent News

      Top 7 Retirement Threats and Effective Strategies to Navigate Them

      Top 7 Retirement Threats and Effective Strategies to Navigate Them

      November 18, 2026
      Charting the Future: Unveiling the TEFCA 2026-2027 Workplan and Innovative Monthly Metrics

      Charting the Future: Unveiling the TEFCA 2026-2027 Workplan and Innovative Monthly Metrics

      November 18, 2026
      Inevitable Buyer’s Remorse Looms Over Midterm Elections

      Inevitable Buyer’s Remorse Looms Over Midterm Elections

      November 18, 2026
      Understanding the Recent Apple Outage: Causes and Implications for Users

      Understanding the Recent Apple Outage: Causes and Implications for Users

      November 18, 2026
      • Home
      • Advertise With Us
      • About Us
      • Corporate
      • Consumer Rewards
      • Forum
      • Privacy Policy
      • Social Trends

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      Welcome Back!

      Login to your account below

      Forgotten Password?

      Retrieve your password

      Please enter your username or email address to reset your password.

      Log In

      Add New Playlist

      We are using cookies to give you the best experience on our website.

      You can find out more about which cookies we are using or switch them off in .

      No Result
      View All Result
      • Home
      • Insight
      • Blog
      • Business
      • Entertainment
      • Health
      • Politics
      • Shop
        • Gift Shop
        • Value Shop
        • Store
        • Bargain Shop
        • Discount
      • Sports
      • Tech
      • Travel
      • USA
      • Video
      • World
        • Asia
        • Africa
        • South America
        • North America
        • Europe
        • Oceania

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      The Insight Post
      Powered by  GDPR Cookie Compliance
      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      Cookie Policy

      More information about our Cookie Policy