| 用途 | 管理员重置用户密码 |
|---|---|
| 语法 | Set-ADAccountPassword -Identity x -Reset -NewPassword (Read-Host -AsSecureString) |
| 配合 | Set-ADUser -ChangePasswordAtLogon $true |
常用示例
常用示例
$pw = Read-Host -AsSecureString '新密码'
Set-ADAccountPassword -Identity ops01 -Reset -NewPassword $pw
Set-ADUser -Identity ops01 -ChangePasswordAtLogon $true
# 解锁(重置后可一并执行)
Unlock-ADAccount -Identity ops01服务账号(如备份、监控)改密必须同步更新所有引用位置,否则会造成批量失败。