我需要重置整个用户密码,然后将它们设置为过期或“用户必须在下次login时更改密码”密码很容易通过SetADAccountPassword更改。
查看SetADAccountControl cmdlet说明build议在说明中有一个“PasswordExpired”参数,但在其余文本中没有提及该参数。 如果我尝试它,它不存在。
理想情况下,我希望有一个相当简单的Powershell命令来做到这一点! 我在服务器上没有任何其他的脚本语言。
谢谢。
Get-ADUser -Identity $name | Set-ADUser -ChangePasswordAtLogon:$true
应该做的伎俩。
Office365 / ExchangeOnline / Exchange 2016内部:
Connect-MsolService $email = [email protected] Set-MsolUser -UserPrincipalName $email |Set-MsolUserPassword -ForceChangePasswordOnly $true -ForceChangePassword $true