Manage passwords

We've already seen how to manage password for service accounts, but in this section we will see how to remove password restrictions and I'll share the simple python script I use to generate complex passwords.

Remove password restrictions

Set-ADDefaultDomainPasswordPolicy -Identity "boxcreator.htb"  -ComplexityEnabled $false

Script to generate complex passwords

import random
import string

def generate_password(length=16):
    characters = string.ascii_letters + string.digits 
    password = ''.join(random.choice(characters) for _ in range(length))
    return password

if __name__ == "__main__":
    password = generate_password()
    print("Generated Password:", password)

Written by ruycr4ft

Last updated