Skip to content

Instantly share code, notes, and snippets.

@phibel
phibel / passwordRotation.ps1
Last active February 2, 2025 15:54
Change Windows Login password on Active Directory (AD) server.
# In my company, you have to change the (Windows) login password (Active Directory AD (LDAP)) every 6 months.
# However, our AD only saves the last 24 passwords in the history, after which you can set your
# original password again. You can only change the password once every 24 hours via the
# "Change Windows password dialog". But I have written this Powershell script that communicates directly
# with the AD server. The script sets 24 passwords and then the original password again.
# The AD has no time limit on how often you can change your password.
#
# I have two user names in the company, the normal user "name" and a user with admin permissions that has
# "admin" as suffix -> "nameadmin". This script changes the password for both accounts!
#