Skip to content

Instantly share code, notes, and snippets.

@drakevonduck
Forked from Purp1eW0lf/Rotate_Passwd.ps1
Created April 6, 2023 22:18
Show Gist options
  • Select an option

  • Save drakevonduck/a2c3e699ee0b1c8f36b63d81a366f2d5 to your computer and use it in GitHub Desktop.

Select an option

Save drakevonduck/a2c3e699ee0b1c8f36b63d81a366f2d5 to your computer and use it in GitHub Desktop.

Revisions

  1. @Purp1eW0lf Purp1eW0lf created this gist Feb 15, 2022.
    11 changes: 11 additions & 0 deletions Rotate_Passwd.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    $user = "erochester" ;
    $newPass = "[New-Password-Please]";

    #Change password twice.
    #First can be junk password, second time can be real new password
    Set-ADAccountPassword -Identity $user -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "6;wB3yj9cI8X" -Force) -verbose

    Set-ADAccountPassword -Identity $user -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "$newPass" -Force) -verbose

    #If the machine is not connected to AD, or account is a local one use this instead
    net user erochester "[New-Password-Please]"