Last updated
Last updated
PS c:\sa> Set-ADAccountPassword {userName} -Reset -NewPassword (ConvertTo-SecureString {"newPassword"} -AsPlainText -Force) -Verbose
PS c:\sa> Set-ADUser {userName} -PasswordNeverExpires $True -Verbose
* can combine both cmds to form a one-liner by appending a semi-colon ";" between the full cmds
- ...-Verbose; Set-ADUser...
PS c:\sa> Set-ADAccountPassword -Identity {userName} -Server {domainName} -OldPassword (ConvertTo-SecureString -AsPlaintext "oldPassword" -force) -NewPassword (ConvertTo-SecureString -AsPlainText "newPassword" -Force)
PS C: > Set-ADUser -Identity "jdoe" -CannotChangePassword $true
* prevent user from changing password