Active Directory

February 11, 2024 · View on GitHub

why do we need active directory?

AD serves as a centralized security management solution that houses all network resources. The purpose of Active Directory is to enable organizations to keep their network secure and organized without having to use up excessive IT resources

ONE-LINERS in powershell

  • Reset password:
        Set-ADAccountPassword <user> -Reset -NewPassword (Read-Host -AsSecureString -Prompt 'New Password') -Verbose
    
  • force to reset password in first logon:
    Set-ADUser -ChangePasswordAtLogon $true -Identity <user> -Verbose
    
  • Find Users or Computer which are expired:
    Search-ADAccount -AccountExpired
    
  • Check If Users password expired:
    Search-ADAccount -PasswordExpired
    
  • Find all locked out account in active directory:
    Search-ADAccount -LockedOut | FT Name,ObjectClass -A
    
  • Find account inactive for last 90 days:
    Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 | FT Name,ObjectClass -A
    
  • Unlock User account:
    Unlock-ADaccount -identity "User"
    
  • Join Active directory:
    Add-Computer -DomainName example.com -DomainCredential 123456789
    

Active Directory one liners

by using CMD you can be fast and dangerous in windows domains!

  • net user The net user command displays user account information on a local computer or the domain.On a PC type net user to see the computer’s account info.
    net user /domain
    
  • Get domain account details:
    net user username /domain
    
  • runas Runas allows you to run a specific tool or program as a different user. For example, you are logged in as a regular user (no administrator rights) and you need to run a program with an account that has local administrator rights.
    runas /user:administrator c:\windows\notepad.exe
    

Resources

link