Pcornel
Automation · Active Directory Automation

Password Operations

Cheat sheet · https://pcornel.dk/topic.php?topic=5692

Back to the Topic

Answer

Password operations automate resets and policy actions with Set-ADAccountPassword, Unlock-ADAccount and Set-ADUser -ChangePasswordAtLogon, passing passwords as SecureString and never logging them.

Remember

  • Pass passwords as SecureString.
  • Never log passwords.
  • Unlock does not reset the password.

First checks

  • Set-ADAccountPassword <u> -Reset -NewPassword (Read-Host -AsSecureString) -WhatIf — reset preview
  • Set-ADUser <u> -ChangePasswordAtLogon $true — force change
  • Unlock-ADAccount <u> — unlock

Verify in this order

verified request → reset/unlock → audit log

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5692

Confirmation

Confirm action

Continue?