Overview [ Documentation]

Module: ActiveDirectory

The Active Directory module requires RSAT tools for Windows.

Manage User Accounts

Locked Accounts

Find locked user accounts:

Search-AdAccount -LockedOut

Unlock user accounts:

Unlock-ADAccount -Identity 'lockeduser'

Or, both in one command:

Search-ADAccount -LockedOut | Unlock-ADAccount

Find the Source of Locked Accounts

  1. Find the Domain Controller with the PDCe role:

    $pdce = Get-ADDomain.PDCEmulator
    
  2. Check the Event Log for lockouts (ID 4740):

    $filter = @{'LogName' = 'Security';'Id' = 4740}
    $events = Get-WinEvent -ComputerName $pdce -FilterHashTable $filter
    $events | Select-Object @{'Name' ='UserName'; Expression={$_.Properties[0]}}, @{'Name' ='ComputerName';Expression={$_.Properties[1]}}
    

Find an AD User by Property

Get-ADUser -Filter "EmployeeNumber -eq '000024'" -Properties *