Advertisement
guyrleech

Reset AD account password expiry weekly

Feb 9th, 2021
1,451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Reset AD password expiry for the specified account once per week
  2. Import-Module ActiveDirectory
  3. [string]$user = "someuser" ; while(1) { get-date ; set-ADUser -Identity $user -replace @{ pwdlastset = 0 } ; set-ADUser -Identity $user  -replace @{ pwdlastset = -1 } ; Get-ADUser -Identity $user -Properties * | select password* ; start-sleep -Seconds (60*60*24*7) }
  4.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement